Link to home
Start Free TrialLog in
Avatar of janu_s
janu_s

asked on

Runtime error '-2147217843 (80040e4d)'

I created an ODBC driver for SQl server using the sa login for authentication , and tested successfully . But when my vb code tries to access the filedsn I created it gives me an error , saying Runtime error '-2147217843 (80040e4d)', [Microsoft][ODBC SQL Server Driver][SQL Server]Login ailed for user 'sa'.

What went wrong here?
Avatar of amit_g
amit_g
Flag of United States of America image

Post the VB code.
Avatar of TAshby
TAshby

yes, paste the code
Avatar of janu_s

ASKER

The following is code I wrote in Visual Basic :

Set SDEAdocon = New ADODB.Connection
SDEAdocon.Open "filedsn=r:\GNIS_Ext\gnis2001"

The code does not give error when I create the ODBC using WindowsNT authentication but gives error when I create using the sa login.
If that is the case, the only thing I can think of is that the password for sa is incorrect in the dsn file.
Change this line:
SDEAdocon.Open "filedsn=r:\GNIS_Ext\gnis2001"

To:
SDEAdocon.Open "filedsn=r:\GNIS_Ext\gnis2001;" & _
           "Uid=yourusernamegoeshere;" & _
           "Pwd=yourpasswordgoeshere"

Anthony
Avatar of janu_s

ASKER

But when I test the connection during the creation of ODBC , it tests sucessfully.Which means the password is correct.
ASKER CERTIFIED SOLUTION
Avatar of amit_g
amit_g
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of janu_s

ASKER

Why didnt I think about that earlier!!.Thanks.
You are welcome.
Anthony
You should have accepted acperkins's comment. acperkins gave the answer. I only explained it.