Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

I'm 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 won't 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.

Edited by matt09524
Posted
I have yet to see the wizard take application variables as part of the connection...generally it's not a big deal thought since I rarely use the wizard; but if you ever find a way, let us know!
Posted
I think you're 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 won't be) and if not, use the coded connection string instead. I wish it would use relative path in the wizard.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...