CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 1999
    Location
    Cincinnati, Ohio
    Posts
    195

    Opening an ADO connection

    I have a program that is openning an ADO connection in VB. It use to work fine, but all of a sudden it doesn't work on my machine nor any of the client's machines. the Err.Number is 3706.

    Dim Cn As ADODB.Connection
    Set Cn = New ADODB.Connection
    Cn.Open "DSN=" + DSN

    DSN is the name of an ODBC connection. I am able to go into Access 97 and link to the DSN source. I am by no way an expert in ADO, might someone have and idea what I am doing wrong? Can someone enlighten me as to how to figure out what the error 3706 means? I am sure I will run into more of them soon


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

    Re: Opening an ADO connection

    Your probably just not logging in successfully. Pass the UID and PWD along with the DSN to the connection and see what happens...

    Dim Cn as ADODB.Connection
    set Cn = new ADODB.Connection
    Cn.Open "DSN=" & sDSN & ";UID=" & sUID & ";PWD=" & sPWD & ";"




    If in your environment, you are using trusted security (with SQL Server and NT) then you might able to get away with just the DSN, but typically a DSN, UID and PWD are required at the minimum to connect. This is what probably happened. Your DBA was using Trusted security (which uses the user's NT login as validation) to connect to the database and then it was changed to use standard security (requiring a user id and password).

    Hope this helps/applies,

    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