私はSQLiteデータベースで作業しています。私はデータベースにデータを挿入しています。しかし、次は私のコードです、私はその動作していないデータベースからデータを削除したい、私は私が間違っているいくつかやっていると思いますいずれかが私を助けてください:iPhoneのSQLiteデータベースからテーブルデータを削除するには
-(IBAction)deleteData {
NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDir = [documentPaths objectAtIndex:0];
NSString *databasePath=[documentsDir stringByAppendingPathComponent:@"paddleEight.sqlite"];
NSLog(@"The Database Path is---> %@", databasePath);
sqlite3_stmt *compiledStatement;
sqlite3 *db;
NSString *sqlStatement = @"DELETE from GalleryTabel;";
if (sqlite3_open([databasePath UTF8String], &db) == SQLITE_OK) {
if (sqlite3_prepare(db, [sqlStatement UTF8String], -1, &compiledStatement, NULL) == SQLITE_OK) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"record" message:@"record Deleted" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
[alert release];
alert=nil;
}
sqlite3_finalize(compiledStatement);
}
}
GalleryTableの綴りは間違っていますか? –
@Toby Allenに返信してくれてありがとうが、私は同じ名前を書いています。論理的な誤りを教えてください。 – iPhone4s
@ iPhone4s私たちとエラーを共有する可能性はありますか? –