我正在尝试使用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);
}
}
该表未进行更新。问题是什么?