开发者

SQL Where Statement - Comparing to Instance Variable in C

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];

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜