Update a record in database

Results 1 to 2 of 2

Thread: Update a record in database

  1. #1
    Join Date
    Dec 1969

    Default Update a record in database

    I am trying to update a record in a database using the following code:<BR>set ordersDB = Server.CreateObject("ADODB.Connection")ordersDB.Op en "invita-13.data"<BR>sqlText = "SELECT * FROM order_item WHERE (order_id = " & p_orderid <BR>sqlText = sqlText & " AND item_id = " & p_orderitemid & " )"<BR>set orderitemSet = Server.CreateObject("ADODB.Recordset")<BR>orderite mSet.Open sqlText, ordersDB<BR>l_quantity = request("p_invitationnumber")<BR>orderitemSet("qua ntity") = l_quantity<BR>orderitemSet("category") = "wedding"<BR>orderitemSet("sub_category") = "inv"<BR>orderitemSet.Update<BR><BR>And then I get the following error message:<BR>ADODB.Field error &#039 800a0cb3&#039 <BR>The operation requested by the application is not supported by the provider. <BR>/order/subsave.inc, line 15 <BR><BR>Thank you for any suggestions!<BR><BR>

  2. #2
    Olivier Guest

    Default RE: Update a record in database

    I found the answer myself.<BR>You have to change the LockType when you open the recordset.<BR><BR>set orderitemSet = Server.CreateObject("ADODB.Recordset")<BR>orderite mSet.LockType = adLockOptimistic &#039&#060;---- added this line<BR>orderitemSet.Open sqlText, ordersDB<BR><BR>When you declare a recordset the default lock type is adLockReadOnly, which obviously does not allow updates.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts