The SELECT statement allows you to retrieve information from the database. When you execute a SELECT statement, the PreparedStatement.ExecuteQuery method returns a ResultSet object.
See UltraLite_PreparedStatement_iface class.
To execute a SELECT statement
Create a prepared statement object.
PreparedStatement * prepStmt = conn->PrepareStatement( UL_TEXT("SELECT MyColumn FROM MyTable") ); |
Execute the statement.
In the following code, the result of the SELECT query contains a string, which is output to the command prompt.
#define MAX_NAME_LEN 100 ULValue val; ResultSet * rs = prepStmt->ExecuteQuery(); while( rs->Next() ){ char mycol[ MAX_NAME_LEN ]; val = rs->Get( 1 ); val.GetString( mycol, MAX_NAME_LEN ); printf( "mycol= %s\n", mycol ); } |
Send feedback about this page via email or DocCommentXchange | Copyright © 2008, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.0 |