SAMPLE: AdoDataGrid.exe Demonstrates How to Use ADO with DataGrid Control Using Visual C++

ID: Q229029


The information in this article applies to:


SUMMARY

The AdoDataGrid sample demonstrates the various uses and combinations of ADO objects, and shows how to use the ADO Recordset object to populate the Microsoft DataGrid control, which makes presenting data through ADO very easy in Visual C++.

The sample also shows how to get results (recordset) based on run-time queries and how to populate the DataGrid control with that recordset. This sample application also demonstrates how to use the OLE DB DataLink interface to build a connection string at run time.


MORE INFORMATION

The following file is available for download from the Microsoft Software Library:

AdoDataGrid.exe
Release Date: May-27-1999

For more information about downloading files from the Microsoft Software Library, please see the following article in the Microsoft Knowledge Base:
Q119591 How to Obtain Microsoft Support Files from Online Services
The AdoDataGrid sample is a FormView-based SDI MFC application. All the files are wizard-generated. After inserting the ActiveX object (Microsoft DataGrid control), the wizard will provide CColumn, CColumns, CDataFormatDisp, CDataGrid, COleFont, CPicture, CSelBookmarks, CSplit, CSplits, and CStdDataFormatsDisp classes in their respective files. No modification was made in DataGrid and its dependent files for this sample.

In this sample, code for manipulating ADO objects is located in AdoDataGridView.cpp. The #import statement for ADO is located in Stdafx.h.

There are three methods to use ADO with Visual C++. In this project, the #import method is used. For additional information about other methods, please see the following article in the Microsoft Knowledge Base:
Q174565 Adovc.exe Demonstrates How to Use ADO with Visual C++

Brief Description of User Interface

NOTE: Datalink (OLE DB connection string building interface) was moved from Msdasc.dll to Oledb32.dll in MDAC 2.1. If you have MDAC version 2.1 or later installed on your machine, replace Msdasc.dll with Oledb32.dll in the #import statement in StdAfx.h.

For additional information about this problem, please see the following article in the Microsoft Knowledge Base:

Q225132 DataLink Type Library Moved from Msdasc.dll to Oledb32.dll
Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Solution Provider or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Solution Providers, please see the following page on the World Wide Web:

http://www.microsoft.com/mcsp/
For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

http://www.microsoft.com/support/supportnet/refguide/


REFERENCES

© Microsoft Corporation 1999, All Rights Reserved.
Contributions by Saqib Rasool, Microsoft Corporation

Additional query words:


Keywords          : kbfile kbADO200 kbADO210 kbDatabase kbVC600 kbGrpVCDB kbGrpMDAC 
Version           : WINDOWS:2.0,2.1,6.0
Platform          : WINDOWS 
Issue type        : 

Last Reviewed: June 2, 1999