|
 |
asp_databases thread: Operation is not allowed when the object is...
Message #1 by "Vince" <cwaves012@y...> on Wed, 23 May 2001 01:35:15
|
|
Hi, I am getting this error "Operation is not allowed when the object is
closed." But if I only want to insert the data, I don't get any error.
However if I query the information back out, the code gives me an error.
Please help. Thanks.
Set objConn = Server.CreateObject("ADODB.Connection") 'creating
active connection'
objConn.Open "Provider= SQLOLEDB;Persist Security Info=False;" & _
"DSN=MP3DB;DATABASE=XXXDB;UID=sa;PWD=;"
Set RSmp3 = Server.CreateObject("ADODB.Recordset")
RSmp3.CursorLocation = adUseClient
RSmp3.LockType = adLockReadOnly
SQL = "INSERT INTO XXXX (A,B,C,D,E,F)" &_
"VALUES('" & A & "','" & B & "','" & C & "','" & D & "','" & E
& "','" & F & "')"
'Response.Write(SQL)
RSmp3.open SQL, objConn
Response.Write ("<TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD>")
RSmp3.MoveFirst '<---- This is where it gives me the error
if not RSmp3.EOF Then
while not RSmp3.EOF
Response.Write RSmp3("LANGUAGES")
Response.Write("</TD><TD>")
RSmp3.MoveNext
wend
End if
Response.Write("</TD></TR></TABLE>")
'RSmp3.close
'Set RSmp3 = nothing
objConn.Close
Set objConn = nothing
Message #2 by "Ken Schaefer" <ken@a...> on Wed, 23 May 2001 17:10:59 +1000
|
|
You need to write a SELECT query to get the data back out.
An Insert query does not return any results - hence you do not get a
recordset afterwards.
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
----- Original Message -----
From: "Vince" <cwaves012@y...>
To: "ASP Databases" <asp_databases@p...>
Sent: Wednesday, May 23, 2001 1:35 AM
Subject: [asp_databases] Operation is not allowed when the object is...
: Hi, I am getting this error "Operation is not allowed when the object is
: closed." But if I only want to insert the data, I don't get any error.
: However if I query the information back out, the code gives me an error.
: Please help. Thanks.
:
:
: Set objConn = Server.CreateObject("ADODB.Connection") 'creating
: active connection'
: objConn.Open "Provider= SQLOLEDB;Persist Security Info=False;" & _
: "DSN=MP3DB;DATABASE=XXXDB;UID=sa;PWD=;"
:
: Set RSmp3 = Server.CreateObject("ADODB.Recordset")
: RSmp3.CursorLocation = adUseClient
: RSmp3.LockType = adLockReadOnly
: SQL = "INSERT INTO XXXX (A,B,C,D,E,F)" &_
: "VALUES('" & A & "','" & B & "','" & C & "','" & D & "','" & E
: & "','" & F & "')"
:
: 'Response.Write(SQL)
:
: RSmp3.open SQL, objConn
.com
|
|
 |