我只获得插入数据库的第二个值.dataHold.Id有一个值,aTextField也是如此.但是,当我查看数据库时,未插入Id.下面的sqlite是否正确?
const char *sql = "insert into Userdata (Id, Name) Values(?, ?)"; sqlite3_stmt *selectstmt; if(sqlite3_prepare_v2(database, sql, -1, &selectstmt, NULL) == SQLITE_OK) { sqlite3_bind_int(selectstmt, dataHold.Id, 1); sqlite3_bind_text(selectstmt, 2, [aTextField.text UTF8String], -1, SQLITE_TRANSIENT); sqlite3_step(selectstmt);
finnw.. 7
应该这样
sqlite3_bind_int(selectstmt, dataHold.Id, 1);
是
sqlite3_bind_int(selectstmt, 1, dataHold.Id);
?
应该这样
sqlite3_bind_int(selectstmt, dataHold.Id, 1);
是
sqlite3_bind_int(selectstmt, 1, dataHold.Id);
?