ADODB help

Leena_A
09-14-2000, 06:42 AM
Hi!
I had written the following code in a program which is giving an error.


The code:
---------
dim cn as connection
dim rs as recordset

Public Sub Form_Load()
set cn=new connection
cn.open "Provider=SQLOLEDB;server=serverlab2;uid=sa;pwd="
cn.defaultdatabase="pubs"

set rs=new recordset
rs.open "Authors",cn,adopenkeyset,adlockoptimistic
End Sub

The error:
----------

Run-time error '-2147467259 (80004005)'
[Microsoft][ODBC Driver Manager] Data Source Name not found and no default driver specified


What could be possibly wrong?

TIA
Leena

Q...
09-14-2000, 10:40 PM
Perhaps you don't have SQLOLEDB provider on your machine?

dusteater
09-16-2000, 12:50 AM
Why don't you try the following connection string instead:
"Provider=Microsoft.Jet.OLEDB.3.51; Data Source=C:<font color=blue>location of your data</font color=blue>"
let us know if that works!!
Rick

jimilorenzo
09-25-2000, 11:24 PM
Try this code ok.
And i hope i works for you ok.


dim cn as connection
dim rs as recordset
dim SQLConStr as string

Public Sub Form_Load()
set cn=new connection

SQLConStr = "driver={SQL Server};server=serverlab2;" & _
"database=pubs;uid=sa;pwd="

cn.open SQLConStr


set rs=new recordset
rs.open "select * from authors",cn,adopenkeyset,adlockoptimistic
End Sub

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum