开发者

iphone sqlite quotes problem

I have a problem with a following sqlite query:

sql = [NSString stringWithFormat:@"Insert into table_name(height)values('%@')",heightarray];

I am getting heightarray from XML, the value of heightarray is:

array =  ( "5'0\"-5'3\"",
           "5'4\"-5'8\"",
           "5'9开发者_StackOverflow\"-6'0\"" )

The \" is added implicitly for some reason, I don't know why?

It is causing problem. please help.


try to use

sql = [NSString stringWithFormat:@"Insert into table_name(height)values(?)"];

and then use

sqlite3_bind_text

If you're using sqlite try this wrapper it helps a lot https://github.com/ccgus/fmdb

There are detailed examples how to use it.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜