iosfmdbselect-queryios-sqlite

Retrieving values from SQLite table iOS


As I'm new to iOS programming,I have a doubt in retrieving data corresponding to a particular integer id from SQLite database table?

This is what I tried but seems wrong:

NSInteger id=  sender.tag;
FMResultSet *rs = [self.databaseFM executeQuery:@"select * from tblVenue where venue_id = ?",id];

Is the problem related to Integer typecasting?


Solution

  • Just use -numberWithInteger: like this :-

    NSInteger id=  sender.tag;
    FMResultSet *rs = [self.databaseFM executeQuery:@"select * from tblVenue where venue_id = ?", [NSNumber numberWithInteger:id]];