Results 1 to 4 of 4

Thread: Opening a connection to an Access database using ADO??????????

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Location
    Ireland
    Posts
    224

    Question

    I have an Access database name called hello.mdb stored in C:\Databases. Can someone please show me how to connect to this database using ADO.
    Thanks in advance
    JK

  2. #2
    New Member
    Join Date
    Oct 2000
    Location
    Houston, Texas
    Posts
    11

    Opening Access Database Using ADO

    Dim DSN As New ADODB.Connection
    Dim Rs As New ADODB.Recordset
    Dim strPath$

    'Access Version
    strPath = "d:\temp\test.mdb"
    With DSN
    .Provider = "Microsoft.Jet.OLEDB.4.0"
    .Open strPath, Uid, PW
    End With
    SQL = "Select * From Table_Name"
    Rs.Open SQL, DSN, adOpenDynamic, adLockOptimistic

    You can do anything you want with this. I usually
    make DSN Global to the whole project, you can then
    use it anywhere.


  3. #3
    New Member
    Join Date
    Oct 2000
    Location
    Houston, Texas
    Posts
    11

    Opening Access Database Using ADO

    Dim DSN As New ADODB.Connection
    Dim Rs As New ADODB.Recordset
    Dim strPath$

    'Access Version
    strPath = "d:\temp\test.mdb"
    With DSN
    .Provider = "Microsoft.Jet.OLEDB.4.0"
    .Open strPath, Uid, PW
    End With
    SQL = "Select * From Table_Name"
    Rs.Open SQL, DSN, adOpenDynamic, adLockOptimistic

    You can do anything you want with this. I usually
    make DSN Global to the whole project, you can then
    use it anywhere.


    Corby Nichols

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Location
    Ireland
    Posts
    224

    Smile

    Thanks for the help
    JK

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width