Contents Index Data retrieval: SELECT Navigating through dynamic SQL result sets

UltraLite for MobileVB User's Guide
  Understanding UltraLite for MobileVB Development
    Accessing data using dynamic SQL
      Data retrieval: SELECT

Get column values from your database

UltraLite for MobileVB provides you with a number of methods to get data of particular types from the UltraLite database into a result set. MobileVB does not permit the use of Variant data types, and because of this, UltraLite for MobileVB is equipped to handle all types of data, but you must use a specific method suitable to each data type contained in your UltraLite database. To call your method, use the following to guide your writing: MyResultSetName.MethodName(Index), where Index is the ordinal position of the column name in your SELECT statement.

Numerous Get types are provided including those for retrieving SQLTypes.

Consider a SELECT query used in the code below. Here, a result set called MyResultSet is created.

Set x = Connection.PrepareStatement( _
  "SELECT ID, Name FROM customer")
Set MyResultSet = x.ExecuteQuery
MyResultSet.MoveFirst

The example below illustrates the use of these methods. This example uses GetInteger and GetString to call Integer and String values from the database into a control on the form:

If MyResultSet.RowCount = 0 Then
  lblID.Text = ""
  txtName.Text = ""
Else
  lblID.Caption = MyResultSet.GetInteger(1)
  txtName.Text = MyResultSet.GetString(2)
End If

GetInteger retrieves integer data from the first column returned by the SELECT query, and the method GetString retrieves string data from the second column returned by the SELECT query.


Contents Index Data retrieval: SELECT Navigating through dynamic SQL result sets