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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recordset Error

Status
Not open for further replies.

sap

Technical User
Aug 20, 2001
37
IN
Hello,
i'm learning asp.While inserting data into access database,
i used follwing code(asp file) it actually inserts the data
but gives Error. Please help.

Error Type :
ADODB.Recordset (0x800A0E78)
Operation is not allowed when the object is closed.
/myasp/MailListInsert.asp, line 13

********
The code for
MailListInsert.asp

<%@ language=VBScript %>
<html>
<head><title>This is ASP Page</title></head>
<body>
<%
info=&quot; ' &quot;&Request.Form(&quot;t1&quot;)&&quot; ',' &quot;&Request.Form (&quot;t2&quot;)&&quot; ',' &quot;&Request.Form (&quot;t3&quot;)&&quot; ',' &quot;&Request.Form (&quot;t4&quot;)&&quot; ' ,' &quot;&Request.Form (&quot;t5&quot;)&&quot; '&quot;
%>
<%
set con= Server.Createobject(&quot;adodb.Connection&quot;)
con.Open &quot;dsn=acc&quot;
set rs= con.Execute(&quot;insert into MailingList(FirstName,LastName,City,Country,Email) values(&quot;&info&&quot;)&quot;)
%>
<%
rs.close
con.close

%>
 
The problem is that you are attempting assign a recordset to a variable (rs) that hasn't been declared as a recordset object variable. You must first declare &quot;rs&quot; just like you did &quot;con&quot;.
Code:
set con= Server.Createobject(&quot;adodb.Connection&quot;)
set rs = Server.Createobject(&quot;adodb.Recordset&quot;)
This should do the trick
 
Have you tried using Response.Write to pinpoint the error?
Also use set rs= nothing
and set con = nothing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top