I am sure that I am missing something simple, and since this forum has been so helpful in the past, I will ask. I am returning a wxSQLite3ResultSet, but no values are passed.
In the following sample, GetID("Jones") results in:
myres 3
res 0
Code: Select all
wxSQLite3ResultSet SQLSelect(wxString sQuery, wxArrayString& params)
{
if(data.IsOpen()) {
try {
wxSQLite3Statement stmt = data.PrepareStatement(sQuery);
int pcount = params.GetCount();
for (int ploop = 0; ploop<pcount; ploop++) {
stmt.Bind(ploop+1,params[ploop]);
}
wxSQLite3ResultSet myres = stmt.ExecuteQuery();
unsigned int id = myres.GetInt("myid");
cout << "myres " << id << "\n";
stmt.Reset();
return myres;
}
catch (wxSQLite3Exception& e) {
ErrorLog(TowxString(e.GetErrorCode()) + ":" + TowxString(e.GetMessage()));
}
}
return wxSQLite3ResultSet();
}
unsigned int GetID(wxString genre)
{
wxArrayString q ;
q.set(ToStdString(genre));
wxSQLite3ResultSet res = SQLSelect("SELECT myid FROM mytable WHERE lastname=?;", q);
unsigned int id = res.GetInt("myid");
cout << "res " << id << "\n";
return id;
}
Thanks in advance.