jayc1

Hey guys i am about to publish my program, but i am scared that when i publish it the database connected will not work. Does anyone know how to make the file path accessible on any computer

con.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = F:\PlayerMeter.mdb"



Re: Visual Basic Express Edition How to make a connected microsoft access data relative

ReneeC

Put the database in the user's local application data - One Click can definitely do this.

Use Microsoft.VisualBasic.FileIO.SpecialDirectories - Microsoft.VisualBasic.FileIO.SpecialDirectories.CurrentUserApplicationData

to place the file......

Reference it via: System.Windows.Forms.Application.UserAppDataPath

So the derivation of your connection string will change

con.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = " + _
Microsoft.VisualBasic.FileIO.SpecialDirectories.CurrentUserApplicationData.Tostring +"\PlayerMeter.mdb"

I don't remember if you need the "\" or not.






Re: Visual Basic Express Edition How to make a connected microsoft access data relative

jayc1

Hey Thankyou very very much......but im still having a probelm this error comes up

Could not find file 'C:\Documents and Settings\Tony\Application Data\Jay C Solutions\Rugby League Statistics\1.0.0.0\PlayerMeter.mdb'.

....i tried to find that file path but i couldnt find it.....could you help me please




Re: Visual Basic Express Edition How to make a connected microsoft access data relative

Freerider

I would use:
con.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = |DataDirectory|\PlayerMeter.mdb"