Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ Sqlite
I need help by inserting the created lines from sqlite into a created listcontrol on my dialog.
BOOL CPrakt04Dlg::OnInitDialog()
{
    CDialog::OnInitDialog();
 
   
    SetIcon(m_hIcon, TRUE);         
    SetIcon(m_hIcon, FALSE);        
 
    
    Tabelle.InsertColumn(0,_T("Number"),LVCFMT_LEFT,35);
    Tabelle.InsertColumn(1, _T("Name"), LVCFMT_CENTER, 60);
    Tabelle.InsertColumn(2, _T("Age"), LVCFMT_LEFT,25);
    Tabelle.InsertColumn(3, _T("Score"), LVCFMT_LEFT, 70);
 
    int nItem;
    nItem = Tabelle.InsertItem(0, _T("1"));
    Tabelle.SetItemText(nItem, 1, _T("Brith"));
    Tabelle.SetItemText(nItem, 2, _T("54"));
    Tabelle.SetItemText(nItem, 3, _T("89"));
 
    nItem = Tabelle.InsertItem(0, _T("2"));
    Tabelle.SetItemText(nItem, 1, _T("Louis"));
    Tabelle.SetItemText(nItem, 2, _T("50"));
    Tabelle.SetItemText(nItem, 3, _T("110"));
 
    nItem = Tabelle.InsertItem(0, _T("3"));
    Tabelle.SetItemText(nItem, 1, _T("Magret"));
    Tabelle.SetItemText(nItem, 2, _T("12"));
    Tabelle.SetItemText(nItem, 3, _T("38"));
 
    nItem = Tabelle.InsertItem(0, _T("4"));
    Tabelle.SetItemText(nItem, 1, _T("Martin"));
    Tabelle.SetItemText(nItem, 2, _T("30"));
    Tabelle.SetItemText(nItem, 3, _T("70"));
 
// I need to get the inserted table here ._.
    
    return TRUE; 
}
 
#if defined(_DEVICE_RESOLUTION_AWARE) && !defined(WIN32_PLATFORM_WFSP)
void CPrakt04Dlg::OnSize(UINT /*nType*/, int /*cx*/, int /*cy*/)
{
    if (AfxIsDRAEnabled())
    {
        DRA::RelayoutDialog(
            AfxGetResourceHandle(), 
            this->m_hWnd, 
            DRA::GetDisplayMode() != DRA::Portrait ? 
            MAKEINTRESOURCE(IDD_PRAKT04_DIALOG_WIDE) : 
            MAKEINTRESOURCE(IDD_PRAKT04_DIALOG));
    }
}
#endif
 
 
 
 void CPrakt04Dlg::OnBnClickedBnTbe()
 {
    int error;
    sqlite3 *database;
    error=sqlite3_open("Database01.db3", &database);
    sqlite3_stmt *statement;
    error=sqlite3_prepare(database, "CREATE TABLE example (number INTEGER,name TEXT,age INTEGER,score INTEGER);", -1, &statement, 0);
    error=sqlite3_step(statement);
    error=sqlite3_exec(database,"insert into example values (5,'david',20,8);",NULL,NULL,NULL);
// this line must go in the listCtrl
    error=sqlite3_finalize(statement);  
    error=sqlite3_close(database);
 
 }
 
 
 
 void CPrakt04Dlg::OnLvnItemchangedTb(NMHDR *pNMHDR, LRESULT *pResult)
 {
     LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);
 
    
    *pResult = 0;
 }
Posted 5-Mar-13 3:13am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You already asked this question at SQLite Database in c++[^]. Please do not repost, go to the original and edit your question if there is additional information to add.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 George Jonsson 215
1 Kornfeld Eliyahu Peter 169
2 OriginalGriff 120
3 PIEBALDconsult 110
4 BillWoodruff 85
0 OriginalGriff 6,165
1 DamithSL 4,658
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,649
4 Sergey Alexandrovich Kryukov 3,294


Advertise | Privacy | Mobile
Web04 | 2.8.141220.1 | Last Updated 5 Mar 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100