Hi...
I have a code that works well on my computer and some pc's but on other pc's it gives me the following exception:
Microsoft Jet Database engine could not find the object 'yahoo.csv' make sure the object exists and that you spell its name and path correctly.
Source Code:
FileInfo file = new System.IO.FileInfo(filename);string ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" +"Data Source=\"" + file.DirectoryName +"\";Extended Properties='text;HDR=Yes;FMT=Delimited(,)';";OleDbConnection conn = new System.Data.OleDb.OleDbConnection(ConnectionString);OleDbCommand cmd = new System.Data.OleDb.OleDbCommand(string.Format("SELECT * FROM [" + file.Name + "]", file.Name), conn);
conn.Open();
//some other code goes here and has no effect on the exception.
conn.Close();
I traced the code and i think the problem could be on the line i highlited above.
Updated Question
I think i have found something concerning the error;
when i trace my code, this is what i get from the line that contains "file.DirectoryName" it says file.Directory= "C:\\Program Files\\Common Files\\Microsoft Shared\\DevServer\\10.0"
i discoverd that i only get this from computers that have been partioned, whereas computers that haven't been partioned it gives me the correct file.DirectoryName.
How do i then solve this error/Exception?
Loading

Andile ChokoPosted Oct 16, 2011, 4:36 PM
when i trace my code, this is what i get from the line that contains "file.DirectoryName" it says file.Directory= "C:\\Program Files\\Common Files\\Microsoft Shared\\DevServer\\10.0"
i discoverd that i only get this from computers that have been partioned, whereas computers that haven't been partioned it gives me the correct file.DirectoryName.
How do i then solve this error/Exception?
Javeed M ShaikhPosted Oct 10, 2011, 8:05 PM
Please do not forget to mark "Accepted Answer".
Andile ChokoPosted Oct 10, 2011, 7:13 PM
Javeed M ShaikhPosted Oct 10, 2011, 5:44 PM
Please do not forget to mark "Accepted Answer".
Andile ChokoPosted Oct 10, 2011, 5:35 PM
Mahesh ChandPosted Oct 10, 2011, 5:06 PM
Get the file name in debugger and copy in your Windows Explorer and see if the file path is correct. It seems like there is an issue with the correct path.
Javeed M ShaikhPosted Oct 10, 2011, 4:58 PM
Did you verify the path and file name is correct, may be the file name is embedded with periods.
Please do not forget to mark "Accepted Answer".