CGXDaoGrid::SetRecordset
void SetRecordset(CDaoRecordset* pSet);
pSet
A pointer to the CDaoRecordset object to be displayed in the grid.
Remarks
Lets you attach the CDaoRecordset object to be displayed in the grid.
See the attached example.
Example
This sample code shows a typical OnInitialUpdate method where a CDaoRecordset is instantiated and attached to the grid.
void CDaobrowsView::OnInitialUpdate()
{
CDaobrowsDoc* pDoc = GetDocument();
if (pDoc->m_pParam == NULL)
{
// construct parameter object
pDoc->m_pParam = new CGXDaoParam;
}
// else
// No data need to be initialized. They are already available in the document.
// pass the pointer to the grid view
SetParam(pDoc->m_pParam, FALSE);
// ^-- indicates that document is responsible
// for deleting the object.
// Attach the recordset object
if (pDoc->m_pStudentSet == NULL)
pDoc->m_pStudentSet = new CStudentset;
m_pSet = pDoc->m_pStudentSet;
SetRecordset(m_pSet);
// standard initialization, will create other objects
// such as column names, widths, base styles, ...
CGXDaoRecordView::OnInitialUpdate();
// Enable Objective Grid internal update-hint mechanism
EnableHints();
// Note: You can use the Window|New command to open a new
// view on the same cursor.
}