Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What does this error mean ?

Status
Not open for further replies.

welshone

Programmer
Jul 30, 2001
414
GB
hello,

When running one of my asp pages I get the following error :

Error: The connection cannot be used to perform this operation. It is either closed or invalid in this context.

the error relates to the sSQL line :

<%@ Language=VBScript %>
<HTML>
<BODY>
<SCRIPT LANGUAGE=VBScript>
Sub CreateDataDoc(oApp)
' Declare variables.
Dim sServer,oDoc,oRS,sTemp,sHead,oRange,oField

' Place your server's name here.
sServer = &quot;8Bells&quot;
' Create a new document.
Set oDoc = oApp.Documents.Add
' Create a new recordset.
Set oRS = CreateObject(&quot;ADODB.Recordset&quot;)
' Open the XML recordset from the server and pass the SQL statement
' to the Getdata.asp page.
sSQL = &quot;SELECT * FROM vSchoolDetails&quot;
oRS.Open &quot; & sServer & &quot;/schoolsasp/Getdata.asp?SQL=&quot; & sSql

also, getdata.asp is :

<%@ Language=VBScript %>
<%
Dim oConn,oRS,strConn,sSQLServer

' Build the connection string.
sSQLServer = &quot;SQLSERVER&quot;
strConn = &quot;Provider=SQLOLEDB.1;Persist Security Info=False;&quot; & _
&quot;User ID=sa;Initial Catalog=schools;Data Source=&quot; & sSQLServer
' Set our return content type.
Response.ContentType = &quot;text/xml&quot;

' Create a connection.
set oConn = Server.CreateObject(&quot;ADODB.Connection&quot;)
' Open the connection.
oConn.Open strConn
' Execute the SQL statement.
set oRS = oConn.Execute(Request.QueryString(&quot;SQL&quot;))
' Save the recordset in the Response object.
oRS.Save Response,1
%>


Can anybody help me ?

thanks
Jamie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top