`wxSQLite3ResultSet' to `int' in assignment Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
nalamar
In need of some credit
In need of some credit
Posts: 7
Joined: Thu Mar 19, 2009 1:02 am

`wxSQLite3ResultSet' to `int' in assignment

Post by nalamar » Thu Mar 19, 2009 10:11 pm

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

mc2r
wxWorld Domination!
wxWorld Domination!
Posts: 1195
Joined: Thu Feb 22, 2007 4:47 pm
Location: Denver, Co
Contact:

Re: `wxSQLite3ResultSet' to `int' in assignment

Post by mc2r » Thu Mar 19, 2009 11:09 pm

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

Post Reply