我想更新我的数据库。数据库中的 regno 没有更新,但其他字段已更新。意味着 regno 是恒定的。
-(BOOL) updateData:(NSString*)name
department:(NSString*)department year:(NSString*)year
{
const char *dbpath = [databasePath UTF8String];
if (sqlite3_open(dbpath, &database) == SQLITE_OK) {
NSString *updateSQL = [NSString stringWithFormat:@"update into studentsDetail name=?, department=?, year=? where regno=? "];
const char *update_stmt = [updateSQL UTF8String];
sqlite3_prepare_v2(database, update_stmt, -1, &statement, NULL);
if (sqlite3_step(statement) == SQLITE_DONE) {
return YES;
}
else{
return NO;
}
sqlite3_reset(statement);
}
return NO;
}