Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.0 » UltraLite - M-Business Anywhere Programming » Understanding UltraLite for M-Business Anywhere development » Working with 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 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 one of the ULTable get methods to get the value of each column for the current row.


The following code fragment retrieves the value of three columns from the tCustomer ULTable object, and displays them in text boxes.

var colID, colFirstName, colLastName;
colID = tCustomer.schema.getColumnID( "id" );
colFirstName = tCustomer.schema.getColumnID( "fname" );
colLastName = tCustomer.schema.getColumnID( "lname" );
alert( tCustomer.getInt( colID ) );
alert( tCustomer.getString( colFirstName ) );
alert( tCustomer.getString( colLastName ) );

You can also use methods of ULTable to set values.

tCustomer.setString( colLastName, "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 fragment generates an error.

id = tCustomer.getInt( colID );