Richard Stern <[EMAIL PROTECTED]> wrote:
Lets say I have the columns MemberNo, Name and Address.
I want to use a specific MemberNo to retrieve a name and address and
store
them in separate variables.

I tried:
sqlite3_exec(AccDataBase,"SELECT Name,Address FROM Accounts WHERE
MemberNo =
2;",Callback(cError,10,&result,&Names),test,&cDatabaseError);

It's probably easier to use sqlite3_prepare and sqlite3_step to execute the query, and sqlite3_column_* to retrieve fields. Something along these lines (error handling omitted for brevity):

sqlite3_stmt* stmt = 0;
sqlite3_prepare(AccDataBase, "SELECT Name,Address FROM ... ;", -1, &stmt, 0);

while (sqlite3_step(stmt) == SQLITE_ROW) {
   string name = (const char*)sqlite3_column_text(stmt, 0);
   string address = (const char*)sqlite3_column_text(stmt, 1);
}

sqlite3_finalize(stmt);

Igor Tandetnik

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to