tags:

views:

446

answers:

1

I get only the second value inserted into the database. dataHold.Id has a value, as does aTextField. However, when I look at the database, the Id isn't being inserted. Is the sqlite below correct?

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);
+5  A: 

Should this

sqlite3_bind_int(selectstmt, dataHold.Id, 1);

be

sqlite3_bind_int(selectstmt, 1, dataHold.Id);

?

finnw