更新时出错。 “U”附近:语法错误

时间:2012-03-16 10:24:52

标签: objective-c ios sqlite

当我尝试更新表格中的条目时,我收到了这个堆栈错误:

Error while updating. near "U": syntax error

我的相关代码是:

const char *dbpath = [dbPath UTF8String];
        sqlite3_stmt    *updateStmt;


        if (sqlite3_open(dbpath, &contactDB) == SQLITE_OK)
        {

            const char*sql="Update quiz set etat=1 where id=?";

            sqlite3_prepare(contactDB, sql, 1, &updateStmt, NULL);

            sqlite3_bind_int(updateStmt, 0, id_quiz);
            sqlite3_step(updateStmt);
            sqlite3_finalize(updateStmt);

            if(SQLITE_DONE != sqlite3_step(updateStmt))
                NSLog(@"Error while updating. %s", sqlite3_errmsg(contactDB));


            sqlite3_close(contactDB);
        }

注意:id_quiz包含类似于1,2等的int值

1 个答案:

答案 0 :(得分:0)

在bind int中,我将使用1索引而不是0

相关问题