Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADODC connection string

Status
Not open for further replies.

calebi

Programmer
Joined
Apr 26, 2002
Messages
1
Location
GB
I am building an application with ADODC connections to an Access database which use a relative path - the exe file and the database are installed in the same folder(the application folder as specified by app.path). This works fine untill my appliction triggers a MAPI session, the program then trys to connect to the database as if in the MAPI folder.

the connect string in ADODC properties is: ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=mydatabase.mdb;Persist Security Info=False"

but after running code from a different folder it looks for the database in c:\program files\common files\system\mapi\1033\nt\mydatabase.mdb

How can I set the current folder the application is working from back to the App folder ?
 
It is looking in your current folder. If your DB is in the same folder as the EXE then use.
[tt]
ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "mydatabase.mdb;Persist Security Info=False"
[/tt]
If it isn't in the same folder you need to add the folder location.
[tt]
ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\MyFolder\mydatabase.mdb;Persist Security Info=False"
[/tt]
Craig, mailto:sander@cogeco.ca

Remember not to name the Lambs...
It only makes the chops harder to swallow
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top