Reputation: 13
I am using sql query using like but it is not returning any thing in below code
NSString *strSelectQuery = [NSString stringWithFormat:@"SELECT * FROM tblrestaurant WHERE address LIKE '%@'",txtField.text];
Upvotes: 1
Views: 99
Reputation: 318824
You need %
characters around the search text. Try this:
NSString *strSelectQuery = [NSString stringWithFormat:@"SELECT * FROM tblrestaurant WHERE address LIKE '%%%@%%'",txtField.text];
Note that the %
symbols are escaped. So yes, that is three %
, then the @
, and then two more %
.
Upvotes: 4