在sqlite中更新语句

sqlite3_stmt *updateStmt = nil;
    if (updateStmt == nil) 
    {
        const char *sql = " update PPM set amount = ? ";
        if (sqlite3_prepare_v2(appDelegate.PPMdatabase, sql, -1,&updateStmt, NULL)!= SQLITE_OK)
        {
            NSAssert (0,@"Error while creating update statement. '%s'",sqlite3_errmsg(appDelegate.PPMdatabase));
        }
    }
    sqlite3_bind_double (updateStmt,1, Val);
if (SQLITE_DONE != sqlite3_step(updateStmt))
    {
        NSAssert(0,@"Error while updating.'%s'",sqlite3_errmsg(appDelegate.PPMdatabase));
    }
    sqlite3_reset(updateStmt);
我得到错误:update.unkown错误时出错     
已邀请:
您应该将
sqlite3_step()
SQLITE_OK
进行比较,然后使用扩展结果代码进行更精细的区分。甚至文档也称这种方案“愚蠢”。 您收到“未知错误”的原因可能是因为您在没有错误时调用
sqlite3_errmsg
(即,step()返回OK)。     

要回复问题请先登录注册