Skip to main content
Participant
August 5, 2009
Question

Update without form using ASP

  • August 5, 2009
  • 1 reply
  • 707 views

Hi, I am able to update records with forms. I now need to update records without the use of forms but keep getting stuck. Your help is very much appreciated. I don't think dreamweaver supports this, so I started adapting my code as as follows:

<%
Dim rsRespondents
Dim rsRespondents_numRows
Set rsRespondents = Server.CreateObject("ADODB.Recordset")
rsRespondents.ActiveConnection = MM_CHRdsn_STRING
rsRespondents.Update="SurveyEmployees SET FirstName='Changed' WHERE EmployeeID='17'"
rsRespondents.CursorType = 0
rsRespondents.CursorLocation = 2
rsRespondents.LockType = 1
rsRespondents.Open()
rsRespondents_numRows = 0
rsRespondents.Connection.Execute
%>

I get the following error:
ADODB.Recordset error '800a0bb9'

Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

/chr_cms/CHROTupdatewithoutform1.asp, line 19 <-- this is the line starting with rsRespondents.Update

I have also used rsRespondents.Update="UPDATE SurveyEmployees .......

but same error message

What am I doing wrong here ?

[Thread moved by moderator to correct forum]

This topic has been closed for replies.

1 reply

Participating Frequently
August 5, 2009

I've never seen the update method used that way - are you sure it's valid?  Typically, you would select the record you want to modify into the recordset, change it, and then call the update method. Or, you can specify the fields and values you want to update as arguments to the method. But I've never seen it include an actual update statement.

http://msdn.microsoft.com/en-us/library/ms676529(VS.85).aspx

louis_109Author
Participant
August 5, 2009

Many thanks  for your quick and helpfull reply !

As I struggled for a moment with an error message referring to the wrong locktype I changed the dreamweaver default locktype from 1 to 2

it worked.

Any implications on changing the locktype that I should be aware of ?