Article ID: 229029 - Last Review: November 23, 2006 - Revision: 3.3 SAMPLE: AdoDataGrid.exe Demonstrates How to Use ADO with DataGrid Control Using Visual C++This article was previously published under Q229029 On This PageSUMMARY 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. NOTE: At the time this sample was developed, table names with spaces were not taken into consideration. For table names with spaces (for instance, "Order Details") or table names that are keywords (for instance, "Section"), this sample may give an error. To correct the problem, modify the code to enclose the table name with brackets ([]); for example, [Order Details]. MORE INFORMATIONThe
following files are available for download from the Microsoft Download
Center: AdoDataGrid.exe
(http://download.microsoft.com/download/ado/utility/1.0/win98/en-us/adodatagrid.exe)
Release Date:
May-27-1999For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base: 119591
(http://support.microsoft.com/kb/119591/EN-US/
)
How to Obtain Microsoft Support Files from Online Services
Microsoft scanned this file for viruses. Microsoft used the most
current virus-detection software that was available on the date that the file
was posted. The file is stored on security-enhanced servers that help to
prevent any unauthorized changes to the file.
Sample File InformationThe 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 #import and other methods, please see the following article in the Microsoft Knowledge Base: 220152
(http://support.microsoft.com/kb/220152/EN-US/
)
Sample: ADOVC1 Simple ADO/VC++ Application
Brief Description of User Interface
For additional information about this problem, please see the following article in the Microsoft Knowledge Base: 225132
(http://support.microsoft.com/kb/225132/EN-US/
)
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 Partner or Microsoft Advisory Services. For more information, visit these Microsoft Web sites: Microsoft Certified Partners - https://partner.microsoft.com/global/30000104 (https://partner.microsoft.com/global/30000104) Microsoft Advisory Services - http://support.microsoft.com/gp/advisoryservice (http://support.microsoft.com/gp/advisoryservice) For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS (http://support.microsoft.com/default.aspx?scid=fh;en-us;cntactms) REFERENCESFor
additional information, click the article number below to view the article in
the Microsoft Knowledge Base: 169498
(http://support.microsoft.com/kb/169498/EN-US/
)
INFO: Extracting Error Information from ADO in VC++ with #import
220152
(http://support.microsoft.com/kb/220152/EN-US/
)
Sample: ADOVC1 Simple ADO/VC++ Application
| Article Translations
|
Back to the top
