2.1 KiB
2.1 KiB
ormAccessUpdate()
The ormAccessUpdate() command updates records in a database table based on the provided selection criteria. This command modifies the values of specified fields in a database using the corresponding values from variables.
Parameters
- fields Type:
variableDescription: A string containing the names of the fields to be updated. The field names should be separated by commas. - fieldsValuesVariables Type:
variableDescription: A string containing the names of the variables holding the new values for the specified fields. The variable names should be separated by commas, in the same order as the fields infields. - dbase Type:
variableDescription: The name of the database where the table to be updated is located. It should be a variable containing the name of the database. - selector Type:
variableDescription: A condition to select the records to be updated. It should be a string specifying the selection criteria in SQL format, such asid = 1. - varTarget Type:
variableDescription: The variable in which the result of the update operation will be stored. It should be a variable that will receive a value indicating whether the update was successful or not.
Command Flow
Example Usage
Suppose you want to update the age field to 31 for the user with id equal to 1 in a database called myDatabase .
// Define variables
fields = "age"
fieldsValuesVariables = "newAge"
dbase = "myDatabase"
selector = "id = 1"
updateSuccess = ''
// Define the variable holding the new value
newAge = 31
// Call the command to update the record
ormAccessUpdate(fields, fieldsValuesVariables, dbase, selector, updateSuccess)
// Return the result of the update via addResult
addResult(updateSuccess)
In this example, the ormAccessUpdate() command will update the age field in the myDatabase database for the record where id = 1 . The new value for age is 31, stored in the newAge variable. The updateSuccess variable will store the result of the operation (whether it was successful or not), and this variable will be returned via addResult(updateSuccess) .