I am having trouble UPDATING
my database using FMDB
. Here's my SQL
BOOL success = [db executeUpdate:[NSString stringWithFormat:@"UPDATE Person SET gender= '%@' WHERE name= '%@'",gender,name]];
I wonder if i made a mistake by using the =
sign to compare (If so how could i correct it). Or any other solution. Help?
EDIT :
DB Error 7: out of memory
2012-03-30 16:10:03.341 den[5168:f803] Error calling sqlite3_step (1: SQL logic error or missing database) SQLITE_ERROR
2012-03-30 16:10:03.343 den[5168:f803] DB Query: COMMIT TRANSACTION;
You should probably use this format:
BOOL success = [db executeUpdate:@"UPDATE Person SET gender = ? WHERE name = ?",gender,name];
You're also using a commit without starting a transaction, so take that bit out as well.