Home All Groups Group Topic Archive Search About
Author
13 Feb 2007 12:08 AM
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.

Author
13 Feb 2007 6:02 AM
Garik
HI pooba53,

Try

MsgBox(Me.OleDbConnection1.ConnectionString)

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

--
Regards,
Garik Melkonyan
MCP, MCAD, MCSD .NET


Show quote
"pooba53" wrote:

> 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.
>
>
Author
13 Feb 2007 6:09 PM
pooba53
On Feb 13, 12:02 am, Garik <garik_ma@do not spam.yahoo.com> wrote:
Show quote
> HI pooba53,
>
> Try
>
> MsgBox(Me.OleDbConnection1.ConnectionString)
>
> after constructing connection string. And You'll see the exact connection
> string at run time.
>
> --
> Regards,
> Garik Melkonyan
> MCP, MCAD, MCSD .NET
>
> "pooba53" wrote:
> > 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.

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.

AddThis Social Bookmark Button