I made a button that deletes all the objects in my array that appear in my table. Then it reloads the data, and the tableview is empty. But how can I delete all data from my SQLite database, not just an array? Now the data appears upon restart. I tried this:
Void button:
- (void) deleteAllButton_Clicked:(id)sender { [appDelegate removeAllBooks:nil]; [self.tableView reloadData]; }
Appdelegate void:
-(void) removeAllBooks:(Book *)bookObj {
Delete syntax in Book.m
- (void) deleteAllBooks { if(deleteStmt == nil) { const char *sql = "WHAT DO I HAVE TO DO TO DELETE ALL THE ROWS?"; if(sqlite3_prepare_v2(database, sql, -1, &deleteStmt, NULL) != SQLITE_OK) NSAssert1(0, @"Error while creating delete statement. '%s'", sqlite3_errmsg(database)); }
source share