I am using FMDB. I have execute the following code
FMResultSet *results = [database executeQuery:@"select * from customer"];
while([results next])
{
Customer *customer = [[Customer alloc] init];
customer.customerId = [results intForColumn:@"id"];
customer.firstName = [results stringForColumn:@"firstname"];
customer.lastName = [results stringForColumn:@"lastname"];
[customers addObject:customer];
NSLog(@"%d", customer.customerId);
}
But I am not getting the customerId value. I just want the rowid which is incremented automatically.
Kindly suggest something…
Create a column with field name
idof type INTEGER PRIMARY KEY. While inserting a row, you don’t need to insert any value for this field.More info
And, Just FYI,
releasethecustomerobject to avoid memory-leak.