CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Guest

    How do I connect to a database who's pathname is supplied in a Microsoft Driver DSN?????????

    Does anyone know how to connect, using Visual Basic code, to a Microsoft Access database, who's pathname is supplied in a DSN?? The DSN is setup as follows:

    It is a SYSTEM DSN, which uses the Microsoft Access Driver.
    In the ODBC Microsoft Access Setup window, I want to access the full pathname listed in the Database section.

    What connect string do I use in MS Access '97 using Visual Basic???


  2. #2
    Join Date
    Jan 2000
    Location
    MO, USA
    Posts
    1,506

    Re: How do I connect to a database who's pathname is supplied in a Microsoft Driver DSN?????????

    Since the database has a dsn, you can use that. But you would be using ODBC instead of OLE DB. But here is how you can use the pre-existing DSN:

    Sub Form_Load()
    Dim cn as ADODB.Connection
    Dim s as string

    s = "DSN=YourDSN"

    set cn = new ADODB.Connection

    cn.Open s

    msgbox "It Worked"

    End Sub




    If this isn't what you're asking, can you please expand your quesion?

    Hope this helps,
    John

    John Pirkey
    MCSD
    www.ShallowWaterSystems.com
    John Pirkey
    MCSD (VB6)
    http://www.stlvbug.org

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

Featured