Can't take data from table Topic is solved

In this forum you can discuss database related issues which can be wxWidgets related, but also generic in nature.
Post Reply
Starosta
In need of some credit
In need of some credit
Posts: 3
Joined: Tue Aug 04, 2009 9:57 am

Can't take data from table

Post by Starosta » Tue Aug 24, 2010 12:32 pm

Hi
I have problem with this code.

Code: Select all

class gtTreeCtrl : public wxTreeCtrl
{
    private:
        wxDbTable* m_RootDbTable;
        wxDbTable* m_ChildrenDbTable;
    public:
        gtTreeCtrl(){};
        gtTreeCtrl(wxWindow *parent, const wxWindowID id,
               const wxPoint& pos, const wxSize& size,
               long style);

        virtual ~gtTreeCtrl         (){};
        void SetRootDbTable         (wxDbTable* RootDbTable){m_RootDbTable = RootDbTable;};
        void SetChildrenDbTable     (wxDbTable* ChildrenDbTable){m_ChildrenDbTable = ChildrenDbTable;};
        bool GetRootNodes           (const wxString &ColumnName);
        bool GetChildrenNodes       (const wxString &ColumnName);
};

 /*

TreeCtrl->SetRootDbTable(Pracownicy); //Somewhere in app
 TreeCtrl->GetRootNodes(wxT("DZIAL"));
*/

bool gtTreeCtrl::GetRootNodes(const wxString &ColumnName)
{
    wxString whereStr;

    if (m_RootDbTable->Open() == false)
		return(false);

    whereStr  = wxT("SELECT DISTINCT ");
    whereStr += ColumnName;
    whereStr += wxT(" FROM ");
    whereStr += m_RootDbTable->GetTableName();

    m_RootDbTable->QueryBySqlStmt(whereStr);

    if (!m_RootDbTable->Query())
    {
        wxString tStr;
        tStr = wxT("Can't return data from m_RootDbTable\n\n");
        wxMessageBox(wxDbLogExtendedErrorMsg(tStr.c_str(),m_RootDbTable->GetDb(),__TFILE__,__LINE__),
                     wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION);

        return(false);
    }

    while (m_RootDbTable->GetNext())
    {
        wxTreeItemId rootId = AddRoot(wxT("Trans"),-1, -1);
        SetItemText(rootId, m_RootDbTable->Dzial);
        return(true);
    }
    return(true);
} //gtTreeCtrl::GetRootNodes()
When I try compile this code, My compiler give me this error:

G:\Programowanie\CB Raporter\GtControls.cpp||In member function `bool gtTreeCtrl::GetRootNodes(const wxString&)':|
G:\Programowanie\CB Raporter\GtControls.cpp|55|error: 'class wxDbTable' has no member named 'Dzial'|
||=== Build finished: 1 errors, 0 warnings ===|

What I do wrong?
In this case is all ok:

Code: Select all

bool SetPracownicyPanel::PutData()
{
    wxDateTime date;
    wxString tStr, tStr1;
    tStr.Printf(wxT("%d/%d/%d"),Pracownicy->Data.year, Pracownicy->Data.month, Pracownicy->Data.day);
    date.ParseDate(tStr);
    DatePickerCtrl1     ->SetValue(date);
    tStr1.Printf(wxT("%d"),Pracownicy->Nr_Kj);
    Nr_Kj_TextCtrl      ->SetValue(tStr1);
    Imie_TextCtrl       ->SetValue(Pracownicy->Imie);
    Nazwisko_TextCtrl   ->SetValue(Pracownicy->Nazwisko);
    Dzial_Choice        ->SetStringSelection(Pracownicy->Dzial);
    return true;
}  // SetPracownicyPanel::PutData()

Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post by Auria » Tue Aug 24, 2010 3:37 pm

First, it's important to know that wxODBC is being removed from newer versions of wxWidgets because it's been unmaintained for years. So I would just recommend looking for another way to access the database
"Keyboard not detected. Press F1 to continue"
-- Windows

Mojo
Super wx Problem Solver
Super wx Problem Solver
Posts: 401
Joined: Wed Sep 21, 2005 8:17 am
Location: Rostov-on-Don, Southern Russia

Post by Mojo » Tue Aug 24, 2010 5:13 pm

Auria wrote:First, it's important to know that wxODBC is being removed from newer versions of wxWidgets because it's been unmaintained for years. So I would just recommend looking for another way to access the database
It's a great pity but it doesn't mean wxODBC is dead, I hope it will useful even after being removed form newer version, cause it works ok separately
http://forums.wxwidgets.org/viewtopic.php?t=28458
Win XP HE SP3, Vista
Xubuntu 12.04 LTS
wxWidgets-2.9.5
wxWidgets-3.0.0

User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2104
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania
Contact:

Post by evstevemd » Sun Aug 29, 2010 5:00 pm

Mojo wrote:
Auria wrote:First, it's important to know that wxODBC is being removed from newer versions of wxWidgets because it's been unmaintained for years. So I would just recommend looking for another way to access the database
It's a great pity but it doesn't mean wxODBC is dead, I hope it will useful even after being removed form newer version, cause it works ok separately
http://forums.wxwidgets.org/viewtopic.php?t=28458
give a shot to DatabaseLayer
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
[Ubuntu 15.04/Windows 10 Pro - GCC/MinGW, CodeLite IDE et al]

Post Reply