UltraLite for MobileVB provides you with a number of methods to navigate a table to perform a wide range of navigation tasks.
The following methods of the ULTable object allow you to navigate your result set:
MoveAfterLast moves to a position after the last row.
MoveBeforeFirst moves to a position before the first row.
MoveFirst moves to the first row.
MoveLast moves to the last row.
MoveNext moves to the next row.
MovePrevious moves to the previous row.
MoveRelative moves a certain number of rows relative to the current row. Positive index values move forward in the table, negative index values move backward in the table, and zero does not move the cursor. Zero is useful if you want to repopulate a row buffer.
The following code opens the customer table and scrolls through its rows. It then displays a message box with the last name of each customer.
'MobileVB using VB6 Dim TCustomer as ULTable Set TCustomer = Conn.GetTable("customer") TCustomer.Open While TCustomer.MoveNext MsgBox TCustomer.Column( "lname" ).StringValue Wend 'Crossfire using vb.net Dim TCustomer as UltraLiteAFLib.ULTable Set TCustomer = Conn.GetTable("Customer") TCustomer.Open While TCustomer.MoveNext MsgBox TCustomer.Column("LName").StringValue Wend
You expose the rows of the table to the application when you open the table object. By default, the rows are exposed in order by primary key value, but you can specify an index to access the rows in a particular order.
The following code moves to the first row of the customer table as ordered by the ix_name index.
'MobileVB using VB6 Set TCustomer = Conn.GetTable("customer") TCustomer.Open "ix_name" TCustomer.MoveFirst 'Crossfire using vb.net TCustomer = Conn.GetTable("customer") TCustomer.Open "ix_name" TCustomer.MoveFirst