At any time, a ULTable object is positioned at one of the following places.
Before the first row of the table.
On a row of the table.
After the last row of the table.
If the ULTable object is positioned on a row, you can use the Column method together with an appropriate property to get the value of that column for the current row.
The following code retrieves the value of three columns from the tCustomer ULTable object, and displays them in text boxes.
Dim colID, colFirstName, colLastName As ULColumn Set colID = tCustomer.Column("ID") Set colFirstName = tCustomer.Column("fname") Set colLastName = tCustomer.Column("lname") txtID.Text = colID.IntegerValue txtFirstName.Text = colFirstName.StringValue txtLastName.Text = colLastName.StringValue
You can also use the properties of ULColumn to set values.
colLastName.StringValue = "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. You cannot, however, get values from the column. For example, the following code generates an error.
' This code is incorrect TCustomer.MoveBeforeFirst id = TCustomer.Column( "ID" ).IntegerValue
To work with binary data, use the GetByteChunk method instead of a property.
See GetByteChunk method.
The ULColumn property you choose must match the Visual Basic data type you want to assign. UltraLite automatically casts incompatible data types, so that you could use the StringValue method to fetch an integer value into a string variable, and so on. See Converting data types explicitly.
For more information about accessing values of the current row, see ULColumn class.