4. --SQLite 专属的增加
发布时间:2020-12-12 19:38:23 所属栏目:百科 来源:网络整理
导读:// 增 -( void )insertStudent:( Student *)student { // 准备插入语句,因为 student 表里的 number 设置的是自增,所以可以不用再次设置。 NSString *insertSQL = [ NSString stringWithFormat : @"INSERT INTO 'student' (name,age,gender) VALUES ('%@',
//增 -(void)insertStudent:(Student *)student { //准备插入语句,因为student表里的number设置的是自增,所以可以不用再次设置。 NSString *insertSQL = [NSString stringWithFormat:@"INSERT INTO 'student' (name,age,gender) VALUES ('%@','%ld','%@')",student.name,student.age,student.gender];
//开始执行 int result = sqlite3_exec(db,insertSQL.UTF8String,NULL,NULL); if (SQLITE_OK == result) { NSLog(@"插入成功"); }else { NSLog(@"插入失败"); }
} (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |