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.
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 ); } |
Discuss this page in DocCommentXchange. Send feedback about this page using email. |
Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1 |