I'm trying to connect a SQL database to a Classic ASP site. I keep getting the following error message no matter what I do:

ADODB.Connection error '800a0e7a'

Provider cannot be found. It may not be properly installed.

I have an ODBC entry for this database, as well as have the following connection info in the file (although I've changed some of these for security b4 posting here):

Set objConn = Server.CreateObject("ADODB.Connection")

objConn.ConnectionString = "Provider={SQL Server};Server=server;Database=db;User ID=id;Pwd=pw"

strSQL = "SELECT * FROM table"

objConn.Open strSQL, objConn

Can someone please point out where I'm amiss as I've been going through Google plus a few examples for this, and am still coming up short.

Read comments in code:

Dim strSQL
Set objConn = Server.CreateObject("ADODB.Connection")
Set objRS   = Server.CreateObject("ADODB.Recordset")
objConn.ConnectionString = "Provider={SQL Server};Server=server;Database=db;User ID=id;Pwd=pw"

strSQL = "SELECT * FROM table"

'open connection first
objConn.open

'execute the sql on the Recordset object
objRS.Open strSQL, objConn, 1,3

If Not objRS.EOF Then
 'iterate through records here
Else
 'no records found
End If
objRS.close
Set objRS=Nothing
objConn.close
Set objConn=Nothing

Thanks for the response, but that doesn't resolve the error. Still getting
ADODB.Connection error '800a0e7a'

Provider cannot be found. It may not be properly installed.

Good to go now. Gotta love bogus messages.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.