Why Won't This Work?

  • Thread starter Thread starter pooba53
  • Start date Start date
P

pooba53

Take a peek at this connection string to an Access db from VB .NET
2003:

'OleDbConnection1
'
Dim AppBase As String
AppBase = AppDomain.CurrentDomain.BaseDirectory & "data.mdb"
MsgBox(AppBase)

Me.OleDbConnection1.ConnectionString = "Jet OLEDB:Global
Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database L" & _
"ocking Mode=1;Data Source=""AppBase"";Jet OLEDB:Engine
Type=5;Provider=""Mic" & _
"rosoft.Jet.OLEDB.4.0"";Jet OLEDB:System database=;Jet
OLEDB:SFP=False;persist sec" & _
"urity info=False;Extended Properties=;Mode=Share Deny
None;Jet OLEDB:Encrypt Dat" & _
"abase=False;Jet OLEDB:Create System Database=False;Jet
OLEDB:Don't Copy Locale o" & _
"n Compact=False;Jet OLEDB:Compact Without Replica
Repair=False;User ID=Admin;Jet" & _
" OLEDB:Global Bulk Transactions=1"

AppBase correctly displays the complete path string to my Access db.
Note that when I use it as the "Data Source=", it does not seem to
find the db. I don't get it...if I hard code the path it works!

Driving me nuts ;-)

Thanks.
 
HI pooba53,

Try

MsgBox(Me.OleDbConnection1.ConnectionString)

after constructing connection string. And You'll see the exact connection
string at run time.
 
HI pooba53,

Try

MsgBox(Me.OleDbConnection1.ConnectionString)

after constructing connection string. And You'll see the exact connection
string at run time.

So it must be a syntax issue as the string shows up as "AppBase". How
do I say, "Please use the string content that AppBase holds? Thanks
for the help.
 
Back
Top