When i try to update a table its giving me a
error message : near "(": syntax error
Please anybody suggest me to rectify this issue.
I am updating a table when i click the save button (Bar button item) on the tool bar which is placed below.
The problem is it's always going to else statement of qlite3_step. I am not getting whats the exact problem for this issue and the above mentioned error.
Any suggestions would be appreciated.
Following is my update method :
-(BOOL)updateFilesTableInDB:(NSDictionary*)dictionaryObject
{
NSLog(@"dictionaryObject %@",dictionaryObject);
NSString *str = [dictionaryObject valueForKey:@"documentType"];
NSString *str1 = [dictionaryObject valueForKey:@"orderNumber"];
NSNumber *num = [dictionaryObject valueForKey:@"filesTableRowID"];
NSLog(@"str %@",str);
NSLog(@"str1 %@",str1);
NSLog(@"num %@",num);
if ([databaseManager didExistDatabaseInDocumentDirectory] == YES)
{
const char *dbpath = [[databaseManager getDatabasePathFromDocument] UTF8String];
sqlite3_stmt *stmt;
if (sqlite3_open(dbpath, &scanningDB) == SQLITE_OK)
{
const char *update_stmt1 = "UPDATE FILES SET (documentType,orderNumber) VALUES (?,?) WHERE ID = ?";
sqlite3_prepare_v2(scanningDB, update_stmt1, -1, &stmt, NULL);
sqlite3_bind_text(stmt, 1, [str UTF8String], -1, SQLITE_TRANSIENT);
sqlite3_bind_text(stmt, 2, [str1 UTF8String], -1, SQLITE_TRANSIENT);
sqlite3_bind_int(stmt, 3,[num intValue]);
if(sqlite3_step(stmt)==SQLITE_DONE)
{
sqlite3_reset(stmt);
NSLog(@"Record Updated Successfully");
}
else
{
NSLog(@"Could not Update Record");
NSLog(@" error message %s",sqlite3_errmsg(scanningDB));
sqlite3_finalize(stmt);
sqlite3_close(scanningDB);
return NO;
}
sqlite3_finalize(stmt);
sqlite3_close(scanningDB);
}
else
return NO;
}
else
return NO;
return YES;
}
Aucun commentaire:
Enregistrer un commentaire