In my iPhone app, I have requirement to search the SQLite database.
I will search the similar data on the basis of what the user enters into the textbox.
What I want:
I want query like
Select category from categorytable where category like 'A%', if user enters A
I tried
NSString *query = [NSString stringWithFormat:@"Select category from categorytable where category like '%@%'",textbox1.text];
It does not show the "%" after the character entered by the user.
In console it shows like
**Select category from categorytable where category like 'A'** which is incorrect
What should be the query?
You need to use %% in stringWithFormat.