Thursday, March 22, 2012

ASP Connections to SQL Server 2000

I am receiving the following error message when attempting to connect to SQL Server 2000.

Please help me!

HERE'S THE ERROR:::::::::::::::::::::::ERROR::::::::::::::::: :::::::::
------------------------

ADODB.Recordset (0x800A0E7D)
The connection cannot be used to perform this operation. It is either closed or invalid in this context.

HERE'S THE CODE USED::::::::::::::::::::::CODE:::::::::::::::::::: ::::::
------------------------

Dim conn, strSQL, rs

set conn = Server.CreateObject("ADODB.Connection")
conn.ConnectionString = "driver={SQL Server};" & _
"server=SF0039;" & _
"Address=10.108.1.58,1433;" & _
"Network=CHICAGO;" & _
"uid=remote;" & _
"pwd=remote;" & _
"database=heat601;"

strSQL = "Select custid from subset"
set rs = Server.CreateObject("ADODB.Recordset")
rs.Open strSQL, connHere is some great page for connection string...

http://www.able-consulting.com/MDAC/ADO/Connection/OLEDB_Providers.htm#OLEDBProviderForSQLServer|||You should open first the connection.

Try this:

Dim conn, strSQL, rs

set conn = Server.CreateObject("ADODB.Connection")
conn.ConnectionString = "driver={SQL Server};" & _
"server=SF0039;" & _
"Address=10.108.1.58,1433;" & _
"Network=CHICAGO;" & _
"uid=remote;" & _
"pwd=remote;" & _
"database=heat601;"
conn.Open

strSQL = "Select custid from subset"
set rs = Server.CreateObject("ADODB.Recordset")
rs.Open strSQL, conn

Originally posted by Terry Ward
I am receiving the following error message when attempting to connect to SQL Server 2000.

Please help me!

HERE'S THE ERROR:::::::::::::::::::::::ERROR::::::::::::::::: :::::::::
------------------------

ADODB.Recordset (0x800A0E7D)
The connection cannot be used to perform this operation. It is either closed or invalid in this context.

HERE'S THE CODE USED::::::::::::::::::::::CODE:::::::::::::::::::: ::::::
------------------------

Dim conn, strSQL, rs

set conn = Server.CreateObject("ADODB.Connection")
conn.ConnectionString = "driver={SQL Server};" & _
"server=SF0039;" & _
"Address=10.108.1.58,1433;" & _
"Network=CHICAGO;" & _
"uid=remote;" & _
"pwd=remote;" & _
"database=heat601;"

strSQL = "Select custid from subset"
set rs = Server.CreateObject("ADODB.Recordset")
rs.Open strSQL, conn

No comments:

Post a Comment