Udostępnij za pośrednictwem


COleDBRecordView::OnGetRowset

Returns a handle for the CRowset<> object associated with the record view.

virtual CRowset< >* OnGetRowset( 
   ) = 0;

Return Value

A standard HRESULT value.

Remarks

You must override this member function to construct or obtain a rowset object and return a handle to it. If you declare your record view class with ClassWizard, the wizard writes a default override for you. ClassWizard's default implementation returns the rowset handle stored in the record view if one exists. If not, it constructs a rowset object of the type you specified with ClassWizard and calls its Open member function to open the table or run the query, and then returns a handle to the object.

Note

Previous to MFC 7.0, OnGetRowset returned a pointer to CRowset. If you have code that calls OnGetRowset, you need to change the return type to the templatized class CRowset<>.

Example

CFrameWnd* pFrame = (CFrameWnd*)AfxGetMainWnd();
COleDBRecordView* pView = (COleDBRecordView*)pFrame->GetActiveView();

// CProductAccessor is a user-defined accessor class
CRowset<CAccessor<CProductAccessor>>* pRowSet = 
   (CRowset<CAccessor<CProductAccessor>>*)pView->OnGetRowset();   

For more information and examples, see the article Record Views: Using a Record View.

Requirements

Header: afxoledb.h

See Also

Reference

COleDBRecordView Class

Hierarchy Chart

Other Resources

COleDBRecordView Members