<< Return to Main Index

< Return to Class Index

class CGXODBCGrid: public CGXBrowserGrid

The CGXODBCGrid class provides functionality for browsing ODBC data sources. As for any CGXBrowserGrid-derived class, this class lets you create MS-Query-like views. It uses the field exchange mechanism to exchange data between the grid and the recordset and supports adding, editing, and deleting records. CGXODBCGrid also supports find and replace and freezing and dragging columns.

The CGXBrowserGrid class maintains one current record with the current cell.  When the user edits data in the current record, all changes are stored in an internal buffer. When the user moves the current cell to another record, changes for the current record are written to the attached CRecordset before the current cell is positioned to a new record. When the user clicks on the last row, a new record will be added to the CRecordset (if it supports appending records).

The state information of the CGXODBCGrid class is stored in the CGXDbParam class. CGXDbParam can be shared among several views (works the same way as CGXGridParam). You can embed it in a document if you want to support several browse views on the same data, as for example in a dynamic splitter window.

CGXODBCGrid is not derived from CWnd. The CGXRecordView class represents the CGXODBCGrid as view. The CGXRecordWnd class represents the CGXODBCGrid as control.

When reading through this class reference you will notice that the CGXODBCGrid is very similar to the CGXDaoGrid implementation. This will make it easier for you to port applications from DAO to ODBC or vice versa.

Note: If you want to support local representations of date/time values you should call

   _tsetlocale(LC_TIME, _T(""))

at the initialization of your application.

It is also recommended that if you want to browse a CRecordset-derived class, which you may have created with ClassWizard, that you replace any CTime attributes with TIMESTAMP_STRUCT members. It is a known limitation of the CTime class that dates earlier than 1970 or after 2037 cannot be represented.

TIMESTAMP_STRUCT does not have such a limitation.

The CGXDynamicRecordset class automatically uses TIMESTAMP_STRUCT instead of CTime.

#include <gxodbc.h>

See Also

CGXDbParam CGXBrowserGrid CGXRecordWnd CGXRecordView CGXDynamicRecordset

CGXODBCGrid

Class Members