0
    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);
        }

Question: Code doesn't work when i insert more than one value in strings productName, regionName and yearName. Need help.

sam
  • 451
  • 3
  • 10
  • 20

1 Answers1

0

Looks to me like there might be a problem with the single quotes inside your productName, regionName and yearName strings:

productName = @"'Fidelity Bonds',Property'";
regionName = @"'London',Paris',Tokyo'";
yearName = @"'2007',2010'";

Have you tried:

productName = @"'Fidelity Bonds','Property'";
regionName = @"'London','Paris','Tokyo'";
yearName = @"'2007','2010'";
Mutix
  • 4,196
  • 1
  • 27
  • 39
  • Check the link that Evgeniy Shurakov posted, I believe you should find your answer there. – Mutix Dec 06 '11 at 13:37