Correct path for connection in wizard

matt09524

Well-known member
Joined
Sep 14, 2005
Messages
47
Im looking for a way to tell the connection wizard, specifically the part about telling it where the db file is, that I want it to look in the application path for the file.

These wont work:

Application.startuppath & \dbdata.mdb
Application.startuppath & "\dbdata.mdb"

I had created a whole app that took me quite a while only to find out that when I deployed it, it is still looking in the bin directory of the project for the database file.

I also tried just adding a new connection string redefining the connection in the form_load method (see below) but that throws an exception when trying to fille the dataset.

OleDbConnection2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Application.StartupPath & \dbdata.mdb;User Id=admin;Password=;"

Im convinced there has to be a way to set the correct path in the wizard.
 
Last edited by a moderator:
I have yet to see the wizard take application variables as part of the connection...generally its not a big deal thought since I rarely use the wizard; but if you ever find a way, let us know!
 
I think youre right. I had to change my code to check to see if the db file was where I set it at design time (which it wont be) and if not, use the coded connection string instead. I wish it would use relative path in the wizard.
 
Back
Top