hi how can i include NSString in the following query.House is as NSString.If i give like following directly, it works fine.but i want to execute through NSString.
NSString* str = @"House";
const char *sqlStatement = "select rowid from 开发者_高级运维PlaceTable where name = 'MyUncleHouse'";
You can use NSString's method called UTF8String as follows:
NSString *str = ["SELECT rowid from PlaceTable where name = '" stringByAppendingFormat:@"%@'",my_uncle_house_str];
const char *sql_statement = [str UTF8String];
You can write like this
NSString* str = @"MyUncleHouse";
NSString* string = [NSString stringWithFormat:@"select rowid from PlaceTable where name = '%@',str];
const char *sql_statement = [str UTF8String];
精彩评论