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

ADODB.Recordset error '800a0e7d'

Status
Not open for further replies.

danalynn

Programmer
Jun 12, 2001
25
0
0
US
i am receiving the following error and have looked many places on how to fix this. i have found nothing. could any of you help me out here

here is the code for my asp page:<%
Option Explicit
Dim strConnect
%>
<html>
<head>
<meta http-equiv=&quot;Content-Type&quot;
content=&quot;text/html; charset-iso-8859-1&quot;>
<meta name=&quot;GENTERATOR&quot; content=&quot;Microsoft FrontPage Express 2.0&quot;>
<title>Adding a new record</title>
</head>

<body bgcolor-&quot;#FFFFFF&quot;>
<%
Dim objRS, intFieldOne, intFieldTwo
Set objRS = Server.CreateObject (&quot;ADODB.Recordset&quot;)
objRS.Open &quot;Provider = SQLOLEDB: Persist Security Info= False;&quot;&_
&quot;User ID=sa; Initial Catalog=quotes;&quot; &_
&quot;Initial File Name=C:/MSSQL7/Data/master.mdf&quot;
objRS.MoveLast
intFieldOne = objRS(&quot;PropNum&quot;) + 1
objRS.AddNew
objRS (&quot;PropNum&quot;) = intFieldOne
objRS (&quot;SalesEng&quot;) = intFieldTwo
objRS.UPDATE
iRecordAdded = objRS.Fields(&quot;New&quot;).Value
Response.Write &quot;You've Successfully added a new record:<BR> &quot;&_
&quot;Prop Number = '&quot;& objRS(&quot;PropNum&quot;) & '&quot;<BR>&quot; &_
&quot;Sales Engineer = '&quot;& objRS(&quot;SalesEng&quot;)
objRS.Close
Set objRS= Nothing
%></body>
</html>

the exact error that i am receiving is:

ADODB.Recorset error '800a0e7d'

Operation is not allowed on an object referencing a closed or invalid connection

/add.asp, line18


thanks in advance

dana

 
Hey dana -
you need to open up a connection first, before you can open up the recordset. see faq333-178 for information on opening up a connection.

after you've got the connection,
just change your rs.open code to something like:

'conn is an open connection
rs.open &quot;select * from tblName&quot;, conn

change the &quot;select * from tblName&quot; to a valid sql string, and you're done!

if you need a tutorial on sql, go to
hope this helps
leo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top