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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access db connection string path in an ActiveX DLL

Status
Not open for further replies.

VBRookie

Programmer
May 29, 2001
331
US
Hi,

I have an application that is 3-tiered with the majority of the business logic being contained in an activex dll. The connection string to the database (MS Access) is contained in the dll (VB COM).

When the user installs the application, I really don't know where they installed it (they could opt to install in a different directory than the default), so I don't want to hardcode the path to the access db in the connectionstring.

The only thing thing that I will know after installation is that the mdb file is in the same directory as the application itself.

How can I find out where it is so that I can set the connection string properly? I was using app.path in the dll but it returns winnt/system32 which isn't what I want. I need to know the path of the application itself not of the object.

Any clue? Your help would be greatly appreciated.

Thanks,
- VB Rookie
 
I do not know if this is the best way but,
You can have the exe write its install path to the registry the first time it runs, then have your dll check that registry key to find out the install path.
 
Thanks woyler,

I think that I may have a workaround. I'm thinking that I will make the connection string a property of each of my objects interfaces and then pass in the value from my application. So I can use the app.path value from within my application and pass it into my object. I was hoping that there was an easier way to do it but this should get it running and actually it will probably make the object more versatile since I can set the connectionstring from the application instead of hardcoding it in the object.

Thanks again for your help.

- VB Rookie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top