[Previous] [TOC] [Next]

Updating a Recordset


Updating a cRecordset object through the DAL occurs by way of the UpdateRecordset method. UpdateRecordset will scan through the internal arrays in the recordset and perform the required database operation. The unique row identifier is used to retrieve each row for modification, so if someone has updated a row while the recordset has been in operation this row will not be found and an error will be raised to alert the developer to this fact. The following is an example of updating a row in a recordset and persisting that change to the data source:

Dim oRec     As New cRecordset
  Dim oDAL
      As New cDAL  ' Assume local DAL so don't need serialization

  Set oRec = oDAL.OpenRecordset("Employees")
  oRec.Edit
  oRec.Fields("FirstName") = "Adam Magee"
  oRec.Update
  oDAL.UpdateRecordset oRec


[Previous] [TOC] [Next]