|
Darn! Still no good. It makes no sense to me. Why fine on one but not on others?
I used to say that I liked programming because of the instant gratification when you compile an app and it works, but this is an example of the dark counterpoint to that. Instant frustration.
|
|
|
|
|
HDR=Yes; Indicates that there are header rows in the sheet,
and IMEX=1; 0 Export mode, 1 Import mode, 2 Linked mode,
I run Imports from excel in 98/XP/Vista with that connection and its all good.
How are you defining your path ie:Filename??
|
|
|
|
|
This is all the relevant code. I just don't get why it would work for the one system but not the others.
string filename = "C:\\Program files\\Daily_Totals_By_Employee.xls";
string listname = "Sheet1";
OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filename + ";Extended Properties = 'Excel 8.0'");
con.Open();
try
{
DataSet myDataSet = new DataSet();
OleDbDataAdapter myCommand = new OleDbDataAdapter(" SELECT * FROM [" + listname + "$]", con);
myCommand.Fill(myDataSet);
con.Close();
|
|
|
|
|
I would try to put the file in a location like "C:\\Myfolder" just to test
eliminate the "Program files" directory and see what happens, also punch in the path manually
Data Source= C:\Myfolder\Daily_Totals_By_Employee.xls
See if any of those work...sorry I can't be any more specific...
|
|
|
|
|
I just tried the path suggestion. I changed the path to
"C:\\csharpdata\\Daily_Totals_By_Employee.xls".
No change.
At the risk of being obtuse, I don't understand how permissions could be the problem. I'm not saying you're all wrong, just that I don't understand it. The file is being opened: wouldn't a permissions issue prevent that? The program opens the file then fails to find the sheet.
|
|
|
|
|
Hi all
I'm a dev newbie and am struggling to get my listbox to work they way i want it to. Basically, i want to be able to store the results of my stored procedure within a listbox control - so for example, if my sproc returns ServerID (primarykey) and ServerName (text column), i want this bound to my listbox control.
In my app i have created a datareader which contains the results of my query. As i loop through the datareader, i want to bind my ServerID and ServerName values to the listbox.
At the moment, I can get ServerName to display in my listbox by implementing the following:
listbox.items.add(System.Convert.ToString(reader[1]));
I then assume i need the following code to assign my query results to the displaymember and valuemember properties:
lbServerList.DisplayMember = reader[1].ToString();
lbServerList.ValueMember = reader[0].ToString();
Now i want to be able to select a server from my drop down list, and get the associated serverid. So for testing purposes, i've created a button and when i click the button, i want the serverid corresponding to the selected servername in my listbox, to be written to a textbox:
if (lbServerList.ValueMember != null)
{
textBox.Text = listbox.ValueMember;
}
A number is indeed written to the textbox but it is a random number which doesn't link to the selected servername, and the number doesn't change no matter what server i select.
Can someone please help fill the gaps in my understanding???
I need to know first whether i'm populating the listbox correctly, and then secondly how to retrieve my serverid from it.
Thanks!
Di
|
|
|
|
|
divinyl wrote: lbServerList.DisplayMember = reader[1].ToString();lbServerList.ValueMember = reader[0].ToString();
its not like this...
first of all make a class that will hold your data(server name and id thing) with the properties
class XHolder
{
string name;
string id;
public string Name
{ get{ return name;} set { name = value; } }
public string ID
{ get{ return id;} set { id = value; } }
}
now you can use Generic list and add like this
List<xholder> dataSource = new List<xholder>();
dataSource.Add(new XHolder(reader[0].ToString(), reader[1].ToString()));
lbServerList.DataSource = dataSource;
lbServerList.DisplayMember = "Name";
lbServerList.ValueMember = "ID";</xholder></xholder>
I wrote code in CP, it may have errors
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Hi guys!
I'm struggling with a weird problem I'm unable to solve so far.
I want to enable drag&drop of mail attachments from Outlook.
This does work when my drop target is, for example, a Form or a Panel ; I can get all the file names and contents, no problem.
As soon as I try the same with a RichTextBox as drop target, it doesn't work - whatever I set the desired DropEffect to (usually DropEffect.Copy ), the cursor is always DropEffect.Move when dragging files from Explorer over the RTB (minor nuisance) and DropEffect.None if I drag mail attachments from Outlook (showstopper).
It doesn't matter if I set the effect in DragEnter or DragOver , if EnableAutoDragDrop is true or false, I've even tried loading a Rich Edit control 4.1 instead of the default V2.0, but to no avail.
Can anyone help?
Thanks in advance!
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
I think its windows inbuilt text effects...
well, try this
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Thanks, but what exactly do you mean by "windows inbuilt text effects"?
It's not that I don't know how to handle drag&drop from outlook in general (it's working fine on non-RichTextBox controls as drop targets). The question is how to make the RTB appreciate the DragDropEffect I set in the DragEnter /DragOver events and not to tell the user that he can't drop an attachment there when I explicitely set the DragDropEffect to Copy .
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
mav.northwind wrote: but what exactly do you mean by "windows inbuilt text effects"?
that mean windows is handling that drag drop itself as text content...
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
I’m a new developer in a very complex project. I like to create a program that can plot the methods that is executing in the program to get a fast view of what is calling what. Of course I can debug the program but the best way right now is to write some code like this:
StackTrace s = new StackTrace();
CallAMettodThatDoesALotOfOtherCalls();
s.PrintAllCalledMethodsInAnEasyToReadWay();
Any tip on code/tool that manages that?
_____________________________
...and justice for all
|
|
|
|
|
Not that I know of, but I'd sure like a copy of such a tool if you can find it
I are troll
|
|
|
|
|
Hi,
I have a webform that shows summary information at the top of the page.
If there is only one "row" in the database for the associated project, the summary looks like this:
Tool_ID= "returned value"
Tool ="returned value"
Tool_Quantity= "returned value"
However if there are multiple tool_ids associated with the project in session (ex, 2 tools), the summary will display each tool in its own column:
Tool_ID= "returned value" Tool_ID= "returned value"
Tool ="returned value" Tool ="returned value"
Tool_Quantity= "returned value" Tool_Quantity= "returned value"
The maximum number of Tool_ids that can be associated with any project is 3. I have a query that will search the project and get the tool_ids, tool and tool_quantity, but I dont know how to code in to display the output as I have listed above. I also need this to be able to get updated as the user can add more tools to the project before submission. Please help!
Thank you
|
|
|
|
|
I have created an application and I am using a panel to load and display custom user controls.
In all these custom controls, there is need save data or cancel changes. I want to design a menu or a tool bar with the save and cancel commands such that changes are saved or cancel depending on the control currently displayed. The save changes command is a little complex for me because the code for saving data would be different for each control. How can I design my menu/tool bar such that the right code executes depending on the displayed control?
Secondly, in my display panel how can I get a "reference" ton the currently displayed/visible control. There could be other controls in the back ground hidden by the current control but I just to be able to reference only the top-most control. NB When I load a control, set I it to fill up the entire panel space which hides any control that may have been visible before but I suppose that does not necessarilly set the visible flag of the previous control to false so. So I can't use the Visible property to check for the "visible" control.
Thanks for you help.
|
|
|
|
|
Here I am trying to fill the tree view category and subcategory wise..see the below
|Benson and Hedges
|Kings Gold Falke
Beverages
| |-Beers
| |-Bell Lager 500 ML
| |-CLUB PILSENER 500 ML
| |-Juices
| |-Apple Juice
| |-Chikooo Juice
|-Food
| |-MeatProducts
| |-GOAT MEAT
| |-Fruits
| |-APPLE GREEN
| |-LOCAL ORANGES
|-VegeTable |
| |-BEETROOT
| |-TOMATO FRESH
I have tried the following code..but I am able to fill only one product under one sub category. Please help me out how to??initialize and fill the data into tree view
foreach (DataRow row in table.Rows)
{
MainNode = new TreeNode(row.ItemArray[0].ToString());
MainNode.Name = row.ItemArray[0].ToString();
if (MainNode.Text == "")
{
}
else
{
ChildNode = new TreeNode(row.ItemArray[1].ToString());
ChildNode.Name = row.ItemArray[1].ToString();
if (ChildNode.Text == "")
{
ChildNode = new TreeNode(row.ItemArray[3].ToString());
ChildNode.Name = row.ItemArray[3].ToString();
ChildNode.Tag = row.ItemArray[2].ToString();
if (!MainNode.Nodes.ContainsKey(ChildNode.Name))
{
MainNode.Nodes.Add(ChildNode);
} }
else
{
SubNode = new TreeNode(row.ItemArray[3].ToString());
SubNode.Name = row.ItemArray[3].ToString();
SubNode.Tag = row.ItemArray[2].ToString();
if (!ChildNode.Nodes.ContainsKey(SubNode.Name))
{
ChildNode.Nodes.Add(SubNode);
} }
if (!MainNode.Nodes.ContainsKey(ChildNode.Name))
{
MainNode.Nodes.Add(ChildNode);
}
else
{
for (int i = 0; i <= MainNode.Nodes.Count; i++)
{ MainNode.Nodes.Add(ChildNode);
} }
if (!RootNode.Nodes.ContainsKey(MainNode.Name))
{
RootNode.Nodes.Add(MainNode);
} } } }
|
|
|
|
|
Problem is
for (int i = 0; i <= MainNode.Nodes.Count; i++)
{ MainNode.Nodes.Add(ChildNode);
}
why this loop...you should learn about recursive methods
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Recursive methods??
Please help me out with an example or an article..I have never worked on it??
|
|
|
|
|
|
Hello!
I have 2 forms. The first has a DataSet with a table("Table1"), the second form has a BindingSource, BindingNavigator, DataGridView;
<br />
Form1 fmMain=new Form1;<br />
Form2 fmSecond=new Form2();<br />
fm.ShowDialog(fmMain)<br />
private void Form2_Load(object sender, EventArgs e)<br />
{<br />
BindingSource.DataSource = ((Form1)this.Parent).DataSet;<br />
BindingSource.DataMember = "Table";<br />
DataGridView.DataSource=BindingSource;<br />
BindingNavigator.BindingSource=BindingSource;<br />
}<br />
BindingNavigator shows that there are 100 rows and the position=1, but DataGridView doesn't display anything.
But this code works:
<br />
Form1 fmMain=new Form1;<br />
Form2 fmSecond=new Form2();<br />
fm.ShowDialog(fmMain)<br />
private void Form2_Load(object sender, EventArgs e)<br />
{<br />
DataGridView dt = new DataGridView();<br />
BindingSource.DataSource = ((Form1)this.Parent).DataSet;<br />
BindingSource.DataMember = "Table";<br />
dt.DataSource=BindingSource;<br />
dt.Parent = this;<br />
BindingNavigator.BindingSource=BindingSource;<br />
}<br />
Does anybody have some ideeas?
|
|
|
|
|
at least can you see the column headers? Do you use AutoGenerateColumns = true , or defined columns?
Calin
|
|
|
|
|
I cannot see them, the DataGridView is empty.
Calin Tatar
Where have you found the property "AutoGenerateColumns"?, I couldn't find it.
|
|
|
|
|
AutoGenerateColumns is not browseable in propertygrid.
You may use it from code:
dataGridView.AutoGenerateColumns = true;
Calin
|
|
|
|
|
Hi i am using WebClient to upload some file to a server using the WebCLient.Uploadfile method
every time i try to run that method its throwing me a bad request error
The remote server returned an error: (400) Bad Request. is the exact exception message.
i dont know where am i doing wrong. everything seems to be ok
can anybody help me on this
i ll appreciate the Help.
Thanks,
Mamtha
|
|
|
|
|