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

Insert into SQL

Status
Not open for further replies.

vlitim

Programmer
Sep 2, 2000
393
GB
I get the below error
Error Type:
ADODB.Recordset (0x800A0E78)
Operation is not allowed when the object is closed.

when using the below code to insert into a dbase, It seems to insert into the dbase but doesn't like the user.close statement, any help please!!

SQL="SELECT id FROM courses_users WHERE id="&userID&" "
set prod=objconn.execute(SQL)

if (prod.BOF and prod.EOF) then
Response.write("get a cookie")

SQLInsert="INSERT INTO courses_users (id, name) VALUES ("&userid&", 'tim')"
set user=objconn.execute(SQLInsert)
user.close
set user=nothing
Flagged = "TRUE"

end if

prod.close

 
Yes, because you never opened it. -- Just used it to execute a command.

For example, prod is open (you opened it implicitly) because you executed a query with it, and so, presumably, it holds some information. However, INSERT INTO is a command that simply does something, nothing more, so there is no open recordset as a result of your:

set user=objconn.execute(SQLInsert)

statement.

hope it helps! :)
Paul Prewett
penny.gif
penny.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top