<< Return to Main Index

< Return to Class Index

CGXAdoGrid::SetRecordset

void SetRecordset(ADORecordset* pSet);

pSet

A pointer to the ADORecordset object to be displayed in the grid.

Remarks

Lets you attach the ADORecordset object to be displayed in the grid.

See the attached example.

Example

This sample code shows a typical OnInitialUpdate method where an ADORecordset is instantiated and attached to the grid.

void CAdpbrowsView::OnInitialUpdate()

{

CAdobrowsDoc* pDoc = GetDocument();

if (pDoc->m_pParam == NULL)

{

// construct parameter object

pDoc->m_pParam = new CGXAdoParam;

}

// 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 = CreateRecordset();//Create the ADORecordset and return it

m_pSet = pDoc->m_pStudentSet;

SetRecordset(m_pSet);

// standard initialization, will create other objects

// such as column names, widths, base styles, ...

CGXAdoRecordView::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.

}

See Also

CGXAdoGrid::OnGetRecordset

CGXAdoGrid

Class Overview | Class Members