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

SQL database update problem with an ASP page

Status
Not open for further replies.

tterrapin

Programmer
Jan 18, 2001
12
CA
Can someone possibly help me. I am trying to update an SQL database thru ASP and can't get the syntax right. Not sure if I need to do something with DBEngine or Workspace or something else. The below query works when doing a plain query but does not work when trying to do an update query. The error that is stated is "ADODB.Recordset (0x800A0E78)
Operation is not allowed when the object is closed.

Here is my code:

set SQLConn = server.CreateObject("ADODB.Connection")
SQLConn.open "dsn=*****;uid=sql_usr_*****;pwd=*****;"

sqlQuery = "Update studentdemo " & _
"set pin = '" & wsPin & "' where " & _
" studnum = '" &PassStudnum & "' "

set SQLRs = server.CreateObject("ADODB.Recordset")

SQLRs.Open sqlQuery, SQLConn


Thanks .. any help would be appreciated.

 
You are trying to create a record set with an Update query. Updates do not return record sets. You should use the execute method to run the Update query and use a Select statement to return a record set. Terry L. Broadbent - DBA
Computing Links:
faq183-874 contains "Suggestions for Getting Quick and Appropriate Answers" to your questions in the SQL Server forum. Many of the ideas apply to all forums.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top