'System.Data.OleDb.OleDbException' when creating a new DataSet..

  • Thread starter Thread starter Brian
  • Start date Start date
B

Brian

I understand to put in the directory address, as in Explorer.

But what about if the project is on another computer.

That's why i require it to be in a location that will be recognised
regardless of what computer's it on - which is why i chose the Debug
folder.

As typically, from what i understand of C#, if you just put a file in
quotes (for example, "photo1.jpg"), it will automatically look for
that file in the Debug folder of your project.

If i was to put in the full address of the database, it would require
the database to be in the exact same location (same drive, same
folder) on another computer..

You understand what i mean?

Thanks!
 
Brian,

Thanks for the clarification. I think that I understand now what you are
asking. The application will search the root directory of the executing
assembly for the database. So if you put:

…Data Source=photoDB.mdb

in the code the connection object will look in the directory of the
executing assembly for the database (make sure that there is a space between
the words Data Source…I didn’t closely check the post that I gave you earlier
for syntax…sorry!).

If you would like to tell the application explicitly to look in the current
directory of the executing assembly you could put:

“…Data Source=†+ System.Environment.CurrentDirectory + "\ photoDB.mdbâ€

and it will definitely look there.

I hope this is what you are looking for!
 
Back
Top