Click to See Complete Forum and Search --> : Setting the Connection String Path


rlschiltz
June 18th, 2001, 12:24 AM
Hi,

I am having a little difficulty in trying to use the package and deployment wizard to package my vb application and access database.

First I need to know how to set the connection string property of the ADO data controls, so that I can run my application from any machine where I install it. Can I use app.path or something similar on the connection string property line (I think app.path can only be used in code. There is a browse button with an ellipsis (...) that asks you to find the database and then sets the connection string property. I believe this is clearly not what I want to do, as I will not know into which directory the end user will place tha application and database. As I type this, it occurs to me that I do recall that you can set the connection string property with code, but I don't remember how. I should be able to find it, but I'll take any help. Once I do this then do I delete any path that is currently set in connection string property? Right now I have something like A:/xxx.mdb. Do I just delete this and let it be filled in at runtime during the form load event. Clearly I am a newbie.

Once this problem is solved, then do I need to make the exe before packaging? I tried this, but the wizard asks me for the .vbp file not the .exe, so I am wondering if the wizard will create the .exe automatically.

Any hints on package and deploying vb apps with access databases would be greatly appreciated.

Thanks,

Lou

Cakkie
June 18th, 2001, 12:57 AM
The connectionsstring is what it is, a string. This gives us the opertunity to assembel the string, and then use it. Ok, now i'm using way to tough language for something really simple

Dim strConnect as string
private Sub Form_Load()
strConnect = "datasource=" & app.path & "\xxx.mdb;uid=you;pwd=......."
cnn.open strConnect
End Sub




For the second question, yes the PDW makes the EXE for you. As a matter of fact, it will ask you. It will first check the date of the file against the date of the project, and if the project is newer, which is almost everytime the case, it will ask you what to do.

Tom Cannaerts
slisse@planetinternet.be

Programming today is a race between software engineers striving to build bigger and better idot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook