用vc采集数据,然后存入access数据库,然后能够在vc里整行的显示数据库里的数据,请问用应该用啥子方法比较好,要不要下专门的vc控件?
请高手指教

解决方案 »

  1.   

    用普通List Control控件可以了.while(条件){
        读数据项;
        listcontrol.InsertItem(行,数据项);
        读数据项;
        listcontrol.SetItemText(行,列,数据项)
    }
      

  2.   

    m_List.Create(WS_CHILD|WS_VISIBLE|WS_BORDER|LVS_REPORT, rect, this, 1);
    m_List.SetExtendedStyle(LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES|LVS_EX_HEADERDRAGDROP);
    m_List.SetBkColor(RGB(125,30,200));
    m_List.SetTextBkColor(RGB(0,0,255)); m_List.InsertColumn(0, "图书名称");
    m_List.InsertColumn(1, "图书ISBN");
    m_List.InsertColumn(2, "价钱");
    m_List.InsertColumn(3, "出版社");
    m_List.InsertColumn(4, "进馆日期");
    m_List.InsertColumn(5, "总数量");
    m_List.InsertColumn(6, "在馆数量"); m_List.SetColumnWidth(0, nWidth/7);
    m_List.SetColumnWidth(1, nWidth/7);
    m_List.SetColumnWidth(2, nWidth/7);
    m_List.SetColumnWidth(3, nWidth/7);
    m_List.SetColumnWidth(4, nWidth/7);
    m_List.SetColumnWidth(5, nWidth/7);
    m_List.SetColumnWidth(6, nWidth/7); theApp.ADOExcute(theApp.m_Set, strSql); int nCount;
    nCount = theApp.m_Set->GetRecordCount();


    if(nCount > 0)
    {
    theApp.m_Set->MoveFirst(); int i =0 ; while(!theApp.m_Set->EndOfFile)
    {
    _variant_t result;
    CString str; result = theApp.m_Set->GetCollect("book_name");
    str = (result.vt == NULL)? "" :(char *)(_bstr_t)result.bstrVal;
    m_List.InsertItem(i, str); result = theApp.m_Set->GetCollect("book_ISBN");
    str = (result.vt == NULL)? "" :(char *)(_bstr_t)result.bstrVal;
    m_List.SetItemText(i, 1, str); result = theApp.m_Set->GetCollect("book_price");
    str.Format("%.2f", result.dblVal);
    m_List.SetItemText(i, 2, str); result = theApp.m_Set->GetCollect("book_public");
    str = (result.vt == NULL)? "" :(char *)(_bstr_t)result.bstrVal;
    m_List.SetItemText(i, 3, str); result = theApp.m_Set->GetCollect("book_intodate");
    m_dTime = result;
    str = m_dTime.Format("%Y-%m-%d");
    m_List.SetItemText(i, 4, str); result = theApp.m_Set->GetCollect("book_Size");
    str.Format("%d", result.intVal);
    m_List.SetItemText(i, 5, str); result = theApp.m_Set->GetCollect("book_AtSize");
    str.Format("%d", result.intVal);
    m_List.SetItemText(i, 6, str); theApp.m_Set->MoveNext();
    i++;
    }
    }
      

  3.   

    同意楼上的,用listctrl就足够了