I get no result when using the below query however i do when i say "SELECT * FROM ORDER_HEADER". I have typed "SELECT * FROM ORDER_HEADER WHERE CUSTOMER = 1" in SqlLite Database Browser and gotten back the correct data. Why am i not receiving my row result? I have also tried SELECT * FROM ORDER_HEADER WHERE CUSTOMER = %d",1. Thank you for your help.
- (void)viewDidLoad{
[super viewDidLoad];
[super viewDidLoad];
salesOrders = [[NSMutableArray alloc] init];
NSString *databasePath = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"MobilePDQ"];
FMDatabase *db = [[FMDatabase alloc] initWithPath:databasePath];
[db open];
FMResultSet *fResult = [db executeQueryWithFormat:@"SELECT * FROM ORDER_HEADER WHERE CUSTOMER = %d",1];
NSLog ( @"has results: %@", [fResult hasAnotherRow] ? @"YES" : @"NO" );
while([fResult next])
{
SalesOrderHeaderController *salesOrder = [SalesOrderHeaderController alloc];
salesOrder.salesOrderID = [fResult intForColumn:@"ID"];
salesOrder.creationDate = [fResult stringForColumn:@"CREATION_DATE"];
[salesOrders addObject:salesOrder];
}
[db close];}
I'm pretty sure it has to do with the CUSTOMER column being a Numeric type? I tried saying "SELECT * FROM ORDER_HEADER WHERE ID = 1" and it worked where ID is an integer primary key datatype. That being said. What do i need to do to search by a Numeric datatype? Thanks again.