In my iPhone application, I am trying to delete a row from a SQLite database. After executing the delete statement, the line seems to be deleted correctly, but after restarting the application, the line still exists. I use code punch to delete a record. Any idea what could be the problem?
NSString *deleteSQL = [NSString stringWithFormat:@"DELETE FROM table1 WHERE actId=%d", actId];
char *errorMsg;
if (database == nil) {
NSLog(@"ERROR db not initialized but trying to delete record!!!");
}else{
if (sqlite3_exec(database, [deleteSQL UTF8String], NULL, NULL, &errorMsg) != SQLITE_OK){
NSAssert1(0, @"Error updating tables: %s", errorMsg);
sqlite3_free(errorMsg);
return NO;
}
}
NSLog([NSString stringWithFormat:@"DELETE Successful"]);
source
share