RecordSet.Update

From Xojo Documentation

Method

RecordSet.Update()

Supported for all project types and targets.

Call to update the RecordSet to reflect changes to the record the record pointer is pointing to.

Notes

Check the Error property after this call. If the record could not be updated then Error will be True. You can then display the error message using the ErrorMessage property.

Some databases do not allow you to update if the SQL statement used to get the RecordSet contains more than one table. Additionally, some databases may require that the SQL statement specifically include the Primary Key for the table.

Updating with MySQL

MySQL cannot guarantee the contents of a RecordSet after issuing an Update call (after having previously called Edit). This means you should not try to modify the contents of a RecordSet in a loop. Instead select just the single record you wish to modify.

Example

Set the string value of a column in a RecordSet:

// rs is a RecordSet with a string column called "ProductName":
rs.Edit
If Not db.Error Then
rs.Field("ProductName").StringValue = "Generic Widgets"
rs.Update
If db.Error Then
MsgBox("DB Error: " + db.ErrorMessage)
End If
Else
MsgBox("DB Error: " + db.ErrorMessage)
End If