我无法在数据库中插入新行。我究竟做错了什么?
-(void)InsertRecords{
fileMgr = [NSFileManager defaultManager];
sqlite3_stmt *stmt;
sqlite3 *cruddb;
const char *sql = "Insert into AllDictionary(id, DeleteFlag, TitleBD, Description, PathToDB, ImageURL) VALUES('565','asasf2','asfas2ff','fggaga2hah','b2bb','aa2aa')";
NSString *cruddatabase = [self.GetDocumentDirectory stringByAppendingPathComponent:@"MainDb.sqlite"];
if(!(sqlite3_open([cruddatabase UTF8String], &cruddb)==SQLITE_OK))
{
NSLog(@"An error has occured: %s",sqlite3_errmsg(cruddb));
}
if (sqlite3_prepare(cruddb, sql, -1, &stmt, NULL)!=SQLITE_OK) {
NSLog(@"Problem with prepare statement: %s", sqlite3_errmsg(cruddb));
} else {
sqlite3_step(stmt);
}
sqlite3_finalize(stmt);
sqlite3_close(cruddb);
}