I have a method which is supposed to return a PatientDetails object when I insert an unique nric as the parameter. This doesn’t work. However when I changed this method to accept int age instead of NSString * nric, it worked.
Is there something wrong with my syntax "WHERE ic = %s" cause it seems wierd. I have googled 2 days on this and cannot find a solution.
Please help as I am a newbie.
- (PatientDetails *)patientDetails:(NSString *)nric {
PatientDetails *retval = nil;
NSString *query = [NSString stringWithFormat:@"SELECT ic, district, age, race, referralSource, DMRelatedAdmin, postalCode FROM patientInfo WHERE ic = %s" , nric];
sqlite3_stmt *statement;
%sdenotes the standard C string. In order to useNSStringobjects as the argument, you need to use the object notation%@.WHERE ic = '%@'