Question about installing programs with databases

dingchavez22
05-10-2004, 11:44 AM
I have some programs that work together with an Acces Database but i have a question before i will use any setup makers.

Say that my app is in 'C:\Program1' and it uses a database from 'C:\Database Program1'. I have connected it with an adodc control (so it's connected to 'C:\Database Program1\Database.mdb'). But if someone wants to install its files to another folder, the connection might get lost and my program wouldn't work. Is that true? Cause when the connection goes to a folder on the 'C-drive' (on my computer), but the user uses the 'D-drive', it would crash the program, right?

Please say that I'm wrong :p

:rolleyes:

Chavez

webbone
05-10-2004, 11:52 AM
It would be best if you install the database file either in the folder with your application or in a subfolder thereof. If you do this, you can use App.Path to determine where you are running from and then set the connection string for your ADODC when your program loads.

Something like this (adjust to suit your needs) in your Form_Load or Sub Main should do what you need:

adodc1.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db1.mdb;Mode=ReadWrite|Share Deny None;Persist Security Info=False;Jet OLEDB;Database Password=guest"


Ultimately you should ditch the ADODC and use straight ADO connections and recordsets to achieve your goals. Check out the Tutor's Corner for some tutorials on ADO.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum