0

我正在尝试使用 XCode 4.3.2 更新 SQLite 数据库中的 Userdetail 表。我正在使用的代码如下:

-(IBAction)saveUserProfile
{
    sqlite3_stmt *statement;
    const char *dbpath = [mDatabasePath UTF8String];

    if (sqlite3_open(dbpath, &mDiary) == SQLITE_OK)
    {
        NSString *updateSQL = [NSString stringWithFormat: 
                               @"UPDATE USERDETAIL SET mUname = \"%@\", mGender = '%@', mEmail = \"%@\", mAddress = \"%@\", mLatitude = \"%@\", mLongitude = \"%@\" WHERE mUserName = \"%@\" ", mUname.text, mGender.text, mEmail.text, mAddress.text, mLatitude.text,mLongitude.text, mUserName];
        const char *update_stmt = [updateSQL UTF8String];
        sqlite3_prepare_v2(mDiary, update_stmt, 
                           -1, &statement, NULL);
        if (sqlite3_step(statement) != SQLITE_DONE){

            mStatus.text = @"Failed to update user profile";
        }

        sqlite3_finalize(statement);
        sqlite3_close(mDiary);
    }
}

该表没有得到更新。问题是什么?

4

0 回答 0