ODBC library Introduction In MFC
---- In MFC, there are five basic types of ODBC data library programming. These classes
ClosedOdbc api calling, enabling users to make full use of ODBC
Class data database compilationSuch as Foxpro, dBASE, or Sybase.
Class-type data warehouse file, avoiding duplication of various types of Data Warehouse files
Complex internal structure. These five base classes are:
The CDatabase class shows the connection between the image table and the data source. The user is based on this
Connect to the data source.
The CRecordset class shows a set of records selected from the data source.
This object enables the user to complete the rollback between records, update records, and
Recording and filtering operations.
The CRecordView class is connected directly to a CRecordset class,
Displays the visual images provided for the recording set. It is the field of data database operations.
The CFieldExchange class supports the field exchange process of the data warehouse, that is, the RFX system.
The exception handling of the CDBException class is equivalent to the exception handling of the data base class. User Root
The original cause or
Displays the corresponding text message.
---- Use AppWizard in VC to generate a simple example
Order for use:
---- 1. Select [New] in [File] and select a File in the displayed dialog box
Class type:[MFC AppWizard (EXE)]. In [Project name], enter the file name,
For example:Testodbc, click the [OK] button.
---- 2. Select [Single document] in the program type, and click the [Next] button.
---- 3. Select [Database view with file support] in the data warehouse support,
Click[Data source] click the button to enter the Data warehouse selection dialog box.
---- 4. Select [ODBC] in [Datasource], and then select
Optional[Visual Foxpro Tables]. [Recordset type] is set to [Snapshot]. Point
Press[OK] press the button to select the data source file: test. dbf.
---- 5. After selecting the source file of the data warehouse, click [Next] to generate a process
Source file.
---- The following classes and their objects are generated at this time:
CAboutDlg
CMainFrame
CTestodbcApp
CTestodbcDoc
CTestodbcSet
CTestodbcView
RFX description
---- RFX is the write-down of Record Field Exchange, meaning that the number of data records is recorded.
Exchange. It specifies the recording set selected by the user.(Data set) and hidden on the back
Establish a relational system between Data sources to enable users to perform operations
This recording set is used to implement data source operations. A series is provided in MFC.
ColumnRFX calls the number of functions. Through these functions, you can record the set and number as needed.
Data exchange is performed between data sources. These letters
Data Types:
Letter countData Type
RFX_BoolBOOL
RFX_ByteBYTE
RFX_BinaryCByteArray
RFX_DoubleDouble
RFX_SingleFloat