How to delete a row in a sqlite database table? How to delete a row in a sqlite database table? sqlite sqlite

How to delete a row in a sqlite database table?


FMDB can be a little finicky if you dont pass in the object as an NSNumber. This is the supported, and safe way of formatting queries.

[db executeUpdate:@"DELETE FROM theTable WHERE id = ?", [NSNumber numberWithInt:myObject.id]];


You should replace:

... [database executeQuery:sqlStat] ...

with:

... [database executeUpdate:sqlStat];

Also, try adding:

[database beginTransaction];

before your CRUD block, and:

[database commit];

after executing an update/delete/insert operation.

;)


i also ran into the same symptom.and my problem was i didnt call (and caused "out of memory" error)

[db open];

be sure to do this to debug your fmdb issuesdb.traceExecution=YES;db.logsErrors=YES;