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 = "8Bells"
' Create a new document.
Set oDoc = oApp.Documents.Add
' Create a new recordset.
Set oRS = CreateObject("ADODB.Recordset"
' Open the XML recordset from the server and pass the SQL statement
' to the Getdata.asp page.
sSQL = "SELECT * FROM vSchoolDetails"
oRS.Open " & sServer & "/schoolsasp/Getdata.asp?SQL=" & sSql
also, getdata.asp is :
<%@ Language=VBScript %>
<%
Dim oConn,oRS,strConn,sSQLServer
' Build the connection string.
sSQLServer = "SQLSERVER"
strConn = "Provider=SQLOLEDB.1;Persist Security Info=False;" & _
"User ID=sa;Initial Catalog=schools;Data Source=" & sSQLServer
' Set our return content type.
Response.ContentType = "text/xml"
' Create a connection.
set oConn = Server.CreateObject("ADODB.Connection"
' Open the connection.
oConn.Open strConn
' Execute the SQL statement.
set oRS = oConn.Execute(Request.QueryString("SQL"
)
' Save the recordset in the Response object.
oRS.Save Response,1
%>
Can anybody help me ?
thanks
Jamie
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 = "8Bells"
' Create a new document.
Set oDoc = oApp.Documents.Add
' Create a new recordset.
Set oRS = CreateObject("ADODB.Recordset"
' Open the XML recordset from the server and pass the SQL statement
' to the Getdata.asp page.
sSQL = "SELECT * FROM vSchoolDetails"
oRS.Open " & sServer & "/schoolsasp/Getdata.asp?SQL=" & sSql
also, getdata.asp is :
<%@ Language=VBScript %>
<%
Dim oConn,oRS,strConn,sSQLServer
' Build the connection string.
sSQLServer = "SQLSERVER"
strConn = "Provider=SQLOLEDB.1;Persist Security Info=False;" & _
"User ID=sa;Initial Catalog=schools;Data Source=" & sSQLServer
' Set our return content type.
Response.ContentType = "text/xml"
' Create a connection.
set oConn = Server.CreateObject("ADODB.Connection"
' Open the connection.
oConn.Open strConn
' Execute the SQL statement.
set oRS = oConn.Execute(Request.QueryString("SQL"
' Save the recordset in the Response object.
oRS.Save Response,1
%>
Can anybody help me ?
thanks
Jamie