productName = @"'Fidelity Bonds',Property'";
regionName = @"'London',Paris',Tokyo'";
yearName = @"'2007',2010'";
sqlite3 *database;
const char *sqlStatement;
sqlite3_stmt *compiledStatement;
[self setPathForDatabase];
if(sqlite3_open([storePath UTF8String], &database) == SQLITE_OK)
{
sqlStatement = "Select * from PorfolioPerformanceCPR where product_name IN (?) and region_name IN (?) and year_name IN (?) group by channel_name";
if(sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK)
{
sqlite3_bind_text(compiledStatement, 1, [productName UTF8String], -1, SQLITE_TRANSIENT);
sqlite3_bind_text(compiledStatement, 2, [regionName UTF8String], -1, SQLITE_TRANSIENT);
sqlite3_bind_text(compiledStatement, 3, [yearName UTF8String], -1, SQLITE_TRANSIENT);
}
问题:当我在字符串productName,regionName和yearName中插入多个值时,代码不起作用。需要帮助。
答案 0 :(得分:0)
在我看来,productName
,regionName
和yearName
字符串中的单引号可能存在问题:
productName = @"'Fidelity Bonds',Property'";
regionName = @"'London',Paris',Tokyo'";
yearName = @"'2007',2010'";
你试过了吗?
productName = @"'Fidelity Bonds','Property'";
regionName = @"'London','Paris','Tokyo'";
yearName = @"'2007','2010'";