Variables/parameters in Sqlite query for Iphone App

前端 未结 1 1521
面向向阳花
面向向阳花 2020-12-20 09:03

In my Iphone App I have created this query:


\"SELECT * FROM visuel where id_visuel = 1\"

And so I have this function that works very wel

1条回答
  •  清酒与你
    2020-12-20 09:44

    Well, first change your query to your parameterized query like you have there. Then, just before you call sqlite3_step bind the right id to the parameter:

    sqlite3_reset(getVisuelStatement);
    
    //Add these two lines
    int visuelId = 1;  //Put whatever id you want in here.
    sqlite3_bind_int(getVisuelParcStatement, 1, visuelId);
    
    while(sqlite3_step(getVisuelParcStatement) == SQLITE_ROW) {
    

    0 讨论(0)
提交回复
热议问题