|
-
Jun 17th, 2007, 02:31 AM
#1
Thread Starter
Lively Member
[RESOLVED] What Variable Type to use in DB Connection String?
Hello again. I am using a CommandDialog to obtain a path to a db, I store the .FileName in a string called dbpath which I declared in the general section with option explicit. I then have a button to connect to the db. I've tried to use the dbpath string and the dbpathtxt.Text in the connection string, and it tries to use the string, not whats stored in the string to connect. Here is my connection string.
CN.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= dbpathtxt.text or dbpath( I tried both here) ;Persist Security Info=False;"
So now when I try to connect, it tries to connect to dbpathtxt.Text instead of the value stored in dbpathtxt.Text. I have tried to use quotes single and double, but it will just error when I do that. So how do I store the path in a variable and get the db to read it like an address?
This is the path that is in the textbox that I store in dbpath and that is dbpathtxt.Text.
C:\Program Files\Microsoft Visual Studio\VB98\vb files\SQL Interpreter\briansdb.mdb
This is what shows up when I try to connect.
Could not connect to: C:\Program Files\Microsoft Visual Studio\VB98\vb files\SQL Interpreter\dbpathtxt.text.
It does this no matter what directory I try to pull a db from. It is reading the path right, but it exchanges the last address with whatever I stored the path in.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|