Could anyone help me with the following WHERE statement ? I want to say "Where Name is equal to name".
NSString *query = [NSString stringWithFormat:@"SELECT Name, Description, Postcode, AddressLine1, ImageURL, 开发者_运维知识库Cost FROM MainDetails WHERE Name=@%", name];
Thanks in advance,
Martin
String values need to be quotes in SQL. So you need something like:
NSString *query = [... "... Name='@%'", name];
(assuming the rest of the syntax is valid, I don't know Objective-C)
Looks like you're missing the single quotes.
NSString *query = [NSString stringWithFormat:@"SELECT Name, Description, Postcode, AddressLine1, ImageURL, Cost FROM MainDetails WHERE Name='@%'", name];
精彩评论