UltraLite for MobileVB User's Guide
Understanding UltraLite for MobileVB Development
Accessing data using the table-based API
UltraLite exposes the rows in a table to your application one at a time. The ULTable object has a current position, which may be on a row, before the first row, or after the last row of the table.
When your application changes its row (by a ULTable.MoveNext method or other method on the ULTable object) UltraLite copies the row to a buffer. There is one buffer per table. Any operations using ULColumn properties to get or set values affect only the copy of data in this buffer. They do not affect the data in the database. For example, the following statement changes the value of the ID column in the buffer to 3.
TCustomer.GetColumn( "ID" ).IntegerValue = 3
UltraLite uses the values in the buffer for a variety of purposes, depending on the kind of operation you are carrying out. UltraLite has four different modes of operation, in addition to a default mode, and in each mode the buffer is used for a different purpose.
Insert mode The data in the buffer is added to the table as a new row when the ULTable.Insert method is called. The buffer is initially empty.
Update mode The data in the buffer replaces the current row when the ULTable.Update method is called.
Find mode The data in the buffer is used to locate rows when one of the ULTable.Find methods is called.
Lookup mode The data in the buffer is used to locate rows when one of the ULTable.Lookup methods is called.
Whichever mode you are using, there is a similar sequence of operations:
Enter the mode.
The ULTable InsertBegin, UpdateBegin, FindBegin, and LookupBegin methods set UltraLite into the mode.
Set the values in the buffer.
Use the ULColumn object to set values in the buffer.
Carry out the operation.
Use a ULTable method such as Insert, Update, FindFirst, or LookupForward to carry out the operation, using the values in the buffer. In most cases the UltraLite mode is set back to the default method and you must enter a new mode before performing another data manipulation or searching operation. An exception is that Delete does not affect the Find mode.