-1

このクエリを sqlite マネージャーで直接テストすると、結果がよく表示されますが、iphone シミュレーターでテストすると、次のように表示されます。

クエリ

この問題を解決するには?

4

2 に答える 2

3

%SQL 内の文字をエスケープして、stringWithFormat値を代入しようとしないようにします。お気に入り:

NSString* select = [NSString stringWithFormat:@"select * from orders where isPaid = 1 and strftime('%%Y-%%m',dateOrder) = '%@'",dateString];
于 2012-10-06T09:04:12.677 に答える
1

コードクエリを次のように置き換えます

NSString* select = [NSString stringWithFormat:@"select * from orders where isPaid = 1 and strftime('%%Y-%%m',dateOrder) = '%@'",dateString];
于 2012-10-06T10:02:44.610 に答える