Salutations,

In the following simple C code (in Console program):

    sqlite3 *db;
    int ret = sqlite3_open("dict.db", &db);
    sqlite3_stmt *stmt;
    char sql[256];
    sprintf(sql, "%s", "select * from a where a = 'key1'");
    int rc = sqlite3_prepare(db, sql, 0, &stmt, 0);
    while(sqlite3_step(stmt) == SQLITE_ROW) {
       printf( (char *)sqlite3_column_text(stmt, 1) );
      };
    sqlite3_finalize(stmt);
    sqlite3_close(db);

I must have made a very simple beginner mistake, because an error happens.
sqlite3_prepare returns SQLITE_OK, but sqlite3_step returns 21
= SQLITE_MISUSE.
Can anyone tell me what I did wrong? It happens with any database I test it
with. Just for information, sqlite3_exec works perfectly.

Thank you in advance.

Reply via email to