Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.
hi i have build an application that is using sqlite3. i can add and delete data from sqlite. problem is with updating data. i am using tableview to display account names, and when user select row from tableview, i display all detail about selected account in a detailview. here (in detail view ) user will see existing values and can change/update that value now my problem is that updation is not taking place i can edit values but icant see updated values in sqlite DB or in table view. any help regarding this will be appreciated
if(SQLITE_DONE != sqlite3_step(updateStmt)) NSAssert1(0, @"Error while inserting data. '%s'", sqlite3_errmsg(database)); else //SQLite provides a method to get the last primary key inserted by using sqlite3_last_insert_rowid //uniqueId = sqlite3_last_insert_rowid(database);
//Reset the add statement. sqlite3_reset(updateStmt);
This seems alright... Have you checked if the variables (name, a, b, c, d, he, uniqueId) have the correct values when running the update function? I mean, after you modify the data in the UI, do they contain the new values, that are to be written in DB?
This seems alright... Have you checked if the variables (name, a, b, c, d, he, uniqueId) have the correct values when running the update function? I mean, after you modify the data in the UI, do they contain the new values, that are to be written in DB?
Replies
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesomeif(updateStmt == nil) {
const char *sql = "update tbl Set f1 = ?,f2 = ?,f3 = ?,f4 = ?,f5= ?,f6 = ? Where ID = ?";
if(sqlite3_prepare_v2(database, sql, -1, &updateStmt, NULL) != SQLITE_OK)
NSAssert1(0, @"Error while creating update statement. '%s'", sqlite3_errmsg(database));
}
sqlite3_bind_text(updateStmt, 1, [name UTF8String], -1, SQLITE_TRANSIENT);
sqlite3_bind_text(updateStmt, 2, [a UTF8String], -1, SQLITE_TRANSIENT);
sqlite3_bind_text(updateStmt, 3, [b UTF8String], -1, SQLITE_TRANSIENT);
sqlite3_bind_text(updateStmt, 4, [c UTF8String], -1, SQLITE_TRANSIENT);
sqlite3_bind_text(updateStmt, 5, [d UTF8String], -1, SQLITE_TRANSIENT);
sqlite3_bind_text(updateStmt, 6, [he UTF8String], -1, SQLITE_TRANSIENT);
sqlite3_bind_int(updateStmt, 7, uniqueId);
if(SQLITE_DONE != sqlite3_step(updateStmt))
NSAssert1(0, @"Error while inserting data. '%s'", sqlite3_errmsg(database));
else
//SQLite provides a method to get the last primary key inserted by using sqlite3_last_insert_rowid
//uniqueId = sqlite3_last_insert_rowid(database);
//Reset the add statement.
sqlite3_reset(updateStmt);
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeCheers.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesomenow i have set the value of PK to value of pk of data that is being edited:cool:
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome