ASP Add Record Approaches

M

Matthew Louden

The following ASP code yields the following run-time error, I want to know
which approaches for adding records. Using "Insert Into" statement or AddNew
method in recordset object?? As I mentioned in previous post, when I use
"Insert Into" SQL statement, it yields "ADODB.Recordset error '800a0e78'
Operation is not allowed when the object is closed."

<%
Dim objRS
Set objRS = Server.CreateObject ("ADODB.Recordset")
objRS.Open "test", strConnect, adOpenStatic, adLockOptimistic, adCmdTable
objRS.MoveLast
objRS.AddNew ' add a new record
objRS("id") = "9999"
objRS("name") = "Psycho"
objRS.Update
objRS.Close
Set objRS = Nothing
%>

ADODB.Recordset error '800a0bb9'
Arguments are of the wrong type, are out of acceptable range, or are in
conflict with one another.
 
K

Ken Schaefer

www.adopenstatic.com/faq/800a0bb9.asp

That said, please see answer to your previous post - you should use the SQL
statement, but not the recordset object.

Cheers
Ken

: The following ASP code yields the following run-time error, I want to know
: which approaches for adding records. Using "Insert Into" statement or
AddNew
: method in recordset object?? As I mentioned in previous post, when I use
: "Insert Into" SQL statement, it yields "ADODB.Recordset error '800a0e78'
: Operation is not allowed when the object is closed."
:
: <%
: Dim objRS
: Set objRS = Server.CreateObject ("ADODB.Recordset")
: objRS.Open "test", strConnect, adOpenStatic, adLockOptimistic,
adCmdTable
: objRS.MoveLast
: objRS.AddNew ' add a new record
: objRS("id") = "9999"
: objRS("name") = "Psycho"
: objRS.Update
: objRS.Close
: Set objRS = Nothing
: %>
:
: ADODB.Recordset error '800a0bb9'
: Arguments are of the wrong type, are out of acceptable range, or are in
: conflict with one another.
:
:
:
:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,811
Latest member
SaulFernan

Latest Threads

Top