喜 我如何在以下查询中包含NSString.House是NSString.If我给 像直接跟随,它工作正常。但我想通过NSString执行。
NSString* str = @"House";
const char *sqlStatement = "select rowid from PlaceTable where name = 'MyUncleHouse'";
答案 0 :(得分:2)
您可以使用名为UTF8String的NSString方法,如下所示:
NSString *str = ["SELECT rowid from PlaceTable where name = '" stringByAppendingFormat:@"%@'",my_uncle_house_str];
const char *sql_statement = [str UTF8String];
答案 1 :(得分:0)
你可以这样写
NSString * str = @“MyUncleHouse”;
NSString * string = [NSString stringWithFormat:@“从PlaceTable中选择rowid,其中name ='%@',str];
const char * sql_statement = [str UTF8String];