Collection Contents Previous Next PDF

UltraLite.NET User's Guide

Understanding UltraLite.NET Development

Accessing and manipulating data with the Table API

Navigating the rows of a table


UltraLite.NET provides you with a number of methods to navigate a table in order to perform a wide range of navigation tasks.

The table object provides you with the following methods to navigate a table.

Example 

The following code opens the MyTable table and displays the value of the MyColumn column for each row.

// iAnywhere.Data.UltraLite namespace
ULTable t = conn.ExecuteTable( "MyTable" );
int colID = t.GetOrdinal( "MyColumn" );
while ( t.MoveNext() ){
   System.Console.WriteLine( t.GetString( colID ) );
}
// iAnywhere.UltraLite namespace
Table t = conn.GetTable( "MyTable" );
short colID = t.Schema.GetColumnID( "MyColumn" );
t.Open();
t.MoveBeforeFirst();
while ( t.MoveNext() ){
   System.Console.WriteLine( t.GetString( colID ) );
}

You expose the rows of the table to the application when you open the table object. By default, the rows are ordered by primary key value, but you can specify an index when opening a table to access the rows in a particular order.

Example 

The following code moves to the first row of the MyTable table as ordered by the ix_col index.

// iAnywhere.Data.UltraLite namespace
ULTable t = conn.ExecuteTable( "MyTable", "ix_col" );
t.MoveFirst();

// iAnywhere.UltraLite namespace
Table t = conn.GetTable( "MyTable" );
t.Open( "ix_col" );
t.MoveFirst();

For more information, see ULTable class and ULTableSchema class and (iAnywhere.Data.UltraLite namespace) or Table class and TableSchema class (iAnywhere.UltraLite namespace).


Collection Contents Previous Next PDF