【发布时间】:2011-10-27 21:18:09
【问题描述】:
由于某种原因,我在数据库中的数据没有被删除,如果您能指出错误,我将不胜感激。
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
NSUInteger row = [indexPath row];
//Delete
sqlite3_stmt *stmt2;
NSArray *del = [[arr objectAtIndex:row] componentsSeparatedByString:@" "];
NSString *update1 = [NSString stringWithFormat:@"delete from survey where name='%@' and surname='%@';",[del objectAtIndex:1],[del objectAtIndex:2]];
int x = sqlite3_prepare_v2(database, [update1 UTF8String], -1, &stmt2, nil);
NSLog(@"x=%d",x);
if (sqlite3_step(stmt2) != SQLITE_DONE)
NSLog(@"Deletion Error.");
[arr removeObjectAtIndex:row];
[tblView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
}
非常感谢。
【问题讨论】:
标签: objective-c ipad ios4 sqlite