0

i am working on sqlite db using c++ front end. when i try to bind variable in the query , it is giving the following error.

here is the code

           for(vector<vector<string> >::iterator it = result.begin(); it < result.end(); ++it)
            {
                vector<string> row = *it;                     
                **sqlite3_bind_text(statement,2,[row.at(1) string],-1, SQLITE_TRANSIENT);**                     
                int result = sqlite3_step(statement);
            }

bolded line is giving the problem which is " cannot convert ‘Database::InitialSync()::’ to ‘const char*’ for argument ‘3’ to ‘int sqlite3_bind_text(sqlite3_stmt*, int, const char*, int, void ()(void))’"

Can anybody help me in this.

4

1 回答 1

0

您有语法错误,只需使用

sqlite3_bind_text(statement,2, row[1].c_str(), -1, SQLITE_TRANSIENT);

如果您需要从“行”数组中提取第一个(不是第零个)值。

如果我误解了你的意思,请澄清你想做的事情,而不仅仅是这个编译错误。我的意思是你想绑定什么参数。

于 2012-05-28T07:05:55.070 回答