Contents Index Scrolling through the rows of a table Searching for rows with find and lookup

UltraLite ActiveX User's Guide
  Understanding UltraLite ActiveX Development
    Accessing and manipulating data using the table API

Accessing the values of the current row


At any time, a ULTable object is positioned at one of the following positions:

If the ULTable object is positioned on a row, you can use the ULColumn.Value property to get the value of that column for the current row. For example, the following code retrieves the value of three columns from the tCustomer ULTable object, and displays them in text boxes.

' eMbedded Visual Basic
Dim colID, colFirstName, colLastName As ULColumn
Set colID = tCustomer.Columns.Item(1)
Set colFirstName = tCustomer.Columns.Item(2)
Set colLastName = tCustomer.Columns.Item(3)
txtID.Text = colID.Value
txtFirstName.Text = colFirstName.Value
txtLastName.Text = colLastName.Value
// JScript
var colID, colFirstName, colLastName;
colID = tCustomer.Columns.Item(1);
colFirstName = tCustomer.Columns.Item(2);
colLastName = tCustomer.Columns.Item(3);
txtID.Text = colID.Value;
txtFirstName.value = colFirstName.Value;
txtLastName.value = colLastName.Value;

You can also use the Value property to set values. For example:

' eMbedded Visual Basic
colLastName.Value = "Kaminski"
// JScript
colLastName.Value = "Kaminski";

By assigning values to these properties you do not alter the value of the data in the database. You can assign values to the properties even if you are before the first row or after the last row of the table, but it is an error to try to access data when the current row is in one of these positions. For example, the following code fragment generates an error.

' This eMbedded Viusal Basic code is incorrect
tCustomer.MoveBeforeFirst
id = colID.Value
Casting values 

As the Value method returns a variant, you can use it to access columns of any data type.


Contents Index Scrolling through the rows of a table Searching for rows with find and lookup