I am new with SQLITE database and I am using FMDB. In my app I want to insert some data into the database. I used the following codes to insert data.
-(void)insertBookmark
{
NSString *bundlePath = [[NSBundle mainBundle] bundlePath];
NSString *dbFilePath = [bundlePath stringByAppendingPathComponent:@"ISGData.sqlite"];
FMDatabase *database = [FMDatabase databaseWithPath:dbFilePath];
[database open];
[database executeUpdate:@"INSERT INTO bookmark (pageno) VALUES (?);",page, nil];
NSLog(@"%@",[database lastErrorMessage]);
[database close];
}
Here "bookmark" is the name of the table in my database having an entity named "pageno" of type integer. While I am passing an int value in the query app crashes showing a bad access. If i am passing a string value, in my log i am getting "not an error", but the values are not getting inserted in to the database. Is there any mistake in my code ?