我无法理解为什么我的 sqlite3 insert 命令只保存某些 index.rows
当前,当用户选择表上的特定行时,以下命令开始
NSMutableString * videoString = [self.filteredVideoArray objectAtIndex:indexPath.row];
NSMutableString * imageString = [self.filteredImageArray objectAtIndex:indexPath.row];
NSMutableString * titleString = [self.filteredTitleArray objectAtIndex:indexPath.row];
NSString * descriptionString = [self.filteredDescriptionArray objectAtIndex:indexPath.row];
NSString *sql = [NSString stringWithFormat:@"INSERT INTO Recent ('name', 'title', 'video', 'image', 'detail' ) VALUES ('%s','%s','%s','%s','%s')", [self.nameString UTF8String],[titleString UTF8String],[videoString UTF8String],[imageString UTF8String] ,[descriptionString UTF8String],NULL];
char *err;
if (sqlite3_exec(db, [sql UTF8String], NULL, NULL, &err) !=SQLITE_OK) {
sqlite3_close(db);
// NSAssert(0, @"could not update table");
}
else{
NSLog(@"table updated");
}
当我 NSLOG
NSLog(@"video = %@",videoString);
NSLog(@"image = %@",imageString);
NSLog(@"detail = %@",descriptionString);
NSLog(@"title = %@",titleString);
NSLog(@"name = %@",self.nameString);
以上所有都返回正确的值。
我不确定您需要哪些其他信息来解决此问题?
谢谢
托马斯