I created a table named "dept" in sqlite manually that has username (as Varchar) and Password (as Integer).
I used the following code to update a table
NSString *database2=[[NSBundle mainBundle]pathForResource:@"deptDatabase" ofType:@"sqlite"];
NSString *databasePath2=[NSString stringWithFormat:@"%@",database2];
const char *dbPath=[databasePath2 UTF8String];
if (sqlite3_open(dbPath, &dbHandler)==SQLITE_OK) {
NSLog(@"database Opened");
const char* updateQuery="update dept set password=1234 where username='suren'";
sqlite3_stmt *stmt;
if (sqlite3_prepare_v2(dbHandler, updateQuery, -1, &stmt, NULL)==SQLITE_OK) {
NSLog(@"Query Executed");
}
}
sqlite3_close(dbHandler);
but the table seems to be not updating. Can anyone pls tell me how to update the table by altering the above code. Thanks in advance