Programming a Dynamic Recordset

If you use AppWizard to create a DAO database application, AppWizard generates a class derived from CDaoRecordset with a DoFieldExchange function that binds data members to the columns in a specific database table. For a dyna-mic recordset class, however, you need to determine the column names and data types at runtime. The EX31A example shows how to do this with ODBC.

With DAO, the procedure is similar. You simply construct a CDaoRecordset object and call the GetFieldValue member function, which returns a VARIANT representing the column value. Other member functions tell you the number of columns in the table and the name, type, and width of each column.

If a field VARIANT contains a BSTR, assume the string contains 8-bit characters. This is an exception to the rule that all BSTRs contain wide characters.



Programming Visual C++
Advanced 3ds max 5 Modeling & Animating
ISBN: 1572318570
EAN: 2147483647
Year: 1997
Pages: 331
Authors: Boris Kulagin

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net