Xcode How To Delete Entry From SQL Issue
===

I have an issue with an SQL statement. I have a UITableView and when the user selects an item they get a list of options. The delete entry is currently coming back with this:

2012-07-21 19:54:08.025 appName[25029:f803] *** Assertion failure in -[listSavedItemsViewController deleteEntryAtLocation:withField1:field1Value:andField2:field2Value:andField3:field3Value:andField4:field4Value:andField5:field5Value:andField6:field6Value:andField7:field7Value:andField8:field8Value:andField9:field9Value:andField10:field10Value:], /Users/Richard/Dropbox/**iOS Development**/App Development/turnAround/listSavedItemsViewController.m:133
2012-07-21 19:54:08.026 appName[25029:f803] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error updating table.'
*** First throw call stack:
(0x159e022 0x172fcd6 0x1546a48 0xa762cb 0x7dbf 0x79fa 0x4b93f1 0x159fe99 0xe214e 0xe20e6 0x188ade 0x188fa7 0x188266 0x1073c0 0x1075e6 0xeddc4 0xe1634 0x1488ef5 0x1572195 0x14d6ff2 0x14d58da 0x14d4d84 0x14d4c9b 0x14877d8 0x148788a 0xdf626 0x2962 0x28d5)
terminate called throwing an exception(lldb) 


The code I am using is similar to the INSERTION code but obviously with a DELETE statement:


NSArray *strSplit = [cellText componentsSeparatedByString:@":"];
    NSString *selectedOrderReference = [strSplit objectAtIndex:2];
    
    NSString *sqlStatement = [NSString stringWithFormat:@"DELETE FROM '%@' WHERE '%@ = '%@')", turnAround, orderRef, selectedOrderReference];
    NSLog(@"Clean: %@", sqlStatement);
    char *err;
    if (sqlite3_exec(turnAroundDB, [sqlStatement UTF8String], NULL, NULL, &err) != SQLITE_OK) {
        sqlite3_close(turnAroundDB);
        NSAssert(0, @"Error updating table.");
    } else {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Deleted" 
                                                        message:@"Your entry has been successful deleted"
                                                       delegate:self 
                                              cancelButtonTitle:@"Done"
                                              otherButtonTitles:nil];
        [alert show];
        [alert release];
    }
