1
Answer

Microsoft Jet Database error

Photo of Andile Choko

Andile Choko

13y
1.3k
1
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?

Answers (1)

0
Photo of Brandon Lewis
NA 603 116k 17y
I might be wrong, but I think its because you can't read XML from a URL. Maybe your mistaking XML for XHTML, which is eXtensibile HyperText Markup Language and its what 90% of web pages are built on these days unless you get into PHP or JavaScript and what not.
XML I believe is used primarily for web data storage on a user's PC and for small and simple database-like needs, it can be read by a web page, but is not an actual part of the build source code. Then again, I could be wrong but in all my web designing in college we never once used XML for the actual code construction of web pages.

-Scrap