Click to See Complete Forum and Search --> : Opening an ADO connection


scarleton
February 9th, 2000, 11:21 AM
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:)

Johnny101
February 9th, 2000, 02:33 PM
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