sqlite3 数据操作 修改



sqlite3 * db = [Database openDB];
    
    sqlite3_stmt * stmt = nil;
    
    NSString * sqlstring = [NSString stringWithFormat:@"update Student set name = ‘%@‘ where id = %ld" , name , (long)ID];
    
    int result = sqlite3_prepare_v2(db, [sqlstring UTF8String], -1, &stmt, NULL);
    
    if (result == SQLITE_OK) {
        
        if (sqlite3_step(stmt) == SQLITE_DONE) {
            
            sqlite3_finalize(stmt);
            [Database closeDB];
            
            return YES;
        }
    }
    
    
    sqlite3_finalize(stmt);
    
    [Database closeDB];
    return NO;



sqlite3 数据操作 修改

上一篇:C# - Excel - Microsoft Access 数据库引擎找不到对象


下一篇:sqlite 打开数据库