SAMPLE: ODBCDATE Sample Illustrates Working with Database DatesLast reviewed: July 18, 1997Article ID: Q117316 |
1.50 1.51 1.52
WINDOWS
kbprg kbfile
The information in this article applies to:
SUMMARYThe ODBCDATE sample illustrates working with dates using the Microsoft Foundation Database Classes. The sample consists of a simple application which has the ability to add, delete, edit, and query for records containing a first name, last name, and birthday date field. NOTE: With the release of Microsoft Visual C++ 2.0 (and later versions) the TIMESTAMP_STRUCT used in this sample was incorporated into the MFC architecture. To obtain the ODBCDATE sample, download ODBCDATE.EXE, a self-extracting file, from the Microsoft Software Library (MSL) on the following services:
ODBCDATE -dSee the README.TXT file included with the sample for more information about how to run it.
MORE INFORMATIONSome of the techniques illustrated by the ODBCDATE sample include:
- Working with dates previous to 1970 and after 2038 by defining a version of the RFX_Date function which works with a TIMESTAMP_STRUCT object instead of a CTime object. - Dynamically building an SQL Query statement based upon information provided by the user at run-time. - Querying for records using a date range.ODBCDATE is based on an AppWizard generated application. Files included with the sample which are directly related to working with dates are:
ADDDLG.CPP - Implements a dialog box which allows the user to add a records to the database. DELDLG.CPP - Implements a dialog box which allows the user to delete records from the database. EDITDLG.CPP - Implements a dialog box which allows the user to edit existing records in the database. QUERYDLG.CPP - Implements a dialog box which allows the user to query for records in the database using any combination of first name, last name, starting date, and ending date. RFXDATE.CPP - Implements the RFX_Date function which works with a TIMESTAMP_STRUCT to get around the CTime limit of not being able to represent dates prior to 1970 and after 2038. |
Additional reference words: 1.50 1.51 1.52 2.50 2.51 2.52 kbinf rfx_date
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |