Page 1 of 1

`wxSQLite3ResultSet' to `int' in assignment

Posted: Thu Mar 19, 2009 10:11 pm
by nalamar
Hi there,
im new to wxsqlite, and i guess thats a really noob problem, but what i have to do to compare integers with an result ?

Here is my code:

Code: Select all

wxString EnMaxDB = wxGetCwd() + _T("/db/enmax.db");
    wxSQLite3Database* db = new wxSQLite3Database();
    db->Open(EnMaxDB);

    wxSQLite3ResultSet* kdrmax = new wxSQLite3ResultSet();
    *(kdrmax) = db->ExecuteQuery("select max(kid) from kunden;");
    int i;
    i = *kdrmax;
    if (i > count)
    {
    count++;
    m_kdrnummer->SetLabel(wxString::Format(wxT("%d"), count));

    }

Thx for help

Nala

Re: `wxSQLite3ResultSet' to `int' in assignment

Posted: Thu Mar 19, 2009 11:09 pm
by mc2r
wxSQLite3ResultSet has functions like GetInt, GetString that return the appropriate type. They take the index of the column they should return the value for.

http://wxcode.sourceforge.net/docs/wxsq ... t_set.html

Code: Select all

wxSQLite3ResultSet* kdrmax = new wxSQLite3ResultSet();
    *(kdrmax) = db->ExecuteQuery("select max(kid) from kunden;");
    int i;
    i = kdrmax->GetInt(0);
-Max