我把我的代码放在这里我没有得到,警报信息有什么问题。
NSString *deleteSQL = [NSString stringWithFormat:@"DELETE FROM FAVOURITE WHERE ID = %@", self.arrayID[[sender tag]]];
const char *delete_stmt = [deleteSQL UTF8String];
NSLog(@"insert query is %@",deleteSQL);
NSLog(@"insert statement is %s",delete_stmt);
sqlite3_prepare_v2(favouriteDB, delete_stmt, 1, &statement, NULL);
NSLog(@"akh:%d",sqlite3_prepare_v2(favouriteDB, delete_stmt, -1, &statement, NULL));
NSLog(@"akhdadsa:%d",SQLITE_DONE);
sqlite3_step(statement);
NSLog(@"this %d", sqlite3_step(statement));
if (sqlite3_step(statement)==SQLITE_DONE)
{
UIAlertView *myAlert1 = [[UIAlertView alloc]initWithTitle:@"Message"
message:@"Successfully Remove From Favourite List"
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:nil];
[myAlert1 show];
}
答案 0 :(得分:1)
您正在拨打sqlite3_step
两次。
第一个调用删除记录,第二个调用失败。
答案 1 :(得分:0)
你已经执行了两次声明。
sqlite3_step(statement);
NSLog(@"this %d", sqlite3_step(statement));
if (sqlite3_step(statement)==SQLITE_DONE)
应该是
//sqlite3_step(statement);//delete this line
NSLog(@"this %d", sqlite3_step(statement));
if (sqlite3_step(statement)==SQLITE_DONE)