64,691
社区成员
发帖
与我相关
我的任务
分享
m_pGridCtrl = new CGridCtrl;
CRect rect(0,0,550,400);
//GetClientRect(rect);
m_pGridCtrl->Create(rect, this, 100);
// fill it up with stuff
m_pGridCtrl->SetEditable(TRUE);
m_pGridCtrl->EnableDragAndDrop(TRUE);
try {
m_pGridCtrl->SetRowCount(20);
m_pGridCtrl->SetColumnCount(5);
m_pGridCtrl->SetFixedRowCount(1);
m_pGridCtrl->SetFixedColumnCount(1);
}
catch (CMemoryException* e)
{
e->ReportError();
e->Delete();
return;
}
CString strConnection = _T("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=data/user.mdb");
if(m_pDb.Open(strConnection))
{
m_pRs = CADORecordset(&m_pDb);
if(m_pRs.Open("MyUser", CADORecordset::openTable))
{
// m_pGridCtrl
//这里怎么将记录集绑定到m_pGridCtrl
//gridctrl怎样显示记录集数据?
m_pRs.GetRecordset();
}
}
else
{
AfxMessageBox(m_pDb.GetLastErrorString());
DWORD dwError = m_pDb.GetLastError();
return FALSE;
}