The following are code samples for insert, update, and delete methods. The samples use a fictitious MyCustomerTable table containing fictitious fields for AccountNumber and CustomerName.
//This will insert a new record into a sample MyCustomerTable table. The only mandatory field that is set on this table is AccountNumber.
private void AddCustomer()
{
MyCustomerTable myCustomerTable;
ttsBegin;
myCustomerTable.AccountNumber = “1234”;
//The new record will have the account number 1234.
myCustomerTable.insert();
ttsCommit;
}
//This will update the record where the AccountNumber field is set to 1234 by adding more information in the CustomerName field.
private void UpdateCustomer()
{
MyCustomerTable myCustomerTable
ttsBegin;
select forUpdate myCustomerTable
where myCustomerTable.AccountNumber == “1234”;
//Now we will update the CustomerName field to be Sally
myCustomerTable.CustomerName = “Sally”;
myCustomerTable.update();
ttsCommit;
}
//This will delete the record from the MyCustomerTable table where the AccountNumber field is set to 1234.
private void DeleteCustomer()
{
ttsBegin;
while select forUpdate myCustomerTable
where myCustomerTable.AccountNumber == “1234”
{
myCustomerTable.delete();
}
ttsCommit;
}