Dbctl.exe Using ODBC in an ActiveX Control

ID: Q152534


The information in this article applies to:
  • The Microsoft Foundation Classes (MFC), used with:
    • Microsoft Visual C++, 32-bit Editions, versions 4.0, 4.1


SUMMARY

DBCTL demonstrates a way to use ODBC in an ActiveX Control (OLE Control). A Visual C++ and a Visual Basic client application are included as part of this sample. The Visual C++ client is called DBUSR, the Visual Basic client is called DBVBUSR.

The following files are available for download from the Microsoft Download Center. Click the file names below to download the files:


Dbctl.exe

For more information about how to download files from the Microsoft Download Center, please visit the Download Center at the following Web address

http://www.microsoft.com/downloads/search.asp
and then click How to use the Microsoft Download Center.

NOTE: Use the -d option when running DBCTL.EXE to decompress the file and recreate the proper directory structure.


MORE INFORMATION

DBCTL creates and opens a Class Wizard-configured CRecordset object from within the virtual override of COleControl::OnSetClientSite. The CRecordset- derived object is configured to the COURSE table of the STDREG32.MDB that comes with the sample.

The CRecordset-derived object is closed from within its own destructor. The CRecordset object is destructed with a call to the delete operator from within the COleControl derived class destructor.

The control exposes one method, a DisplayRecords method, that simply lists the contents of the recordset in the control.

The OLE Control subclasses a listbox. The string items are added to the listbox by using SendMessage.

The DBUSR.EXE and DBVBUSR.EXE demonstrate using the custom control.

Additional query words:

Keywords : kbfile kbprg kbsample kbDatabase kbMFC kbODBC kbVC
Version : winnt:4.0,4.1
Platform : winnt
Issue type :


Last Reviewed: December 10, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.