The information in this article applies to:
SUMMARYThe ADOVC1.exe sample is an ADO/Visual C++ console application that demonstrates #import of ADO. MORE INFORMATIONThe following file is available for download from the Microsoft
Download Center. Click the file name below to download the file: Adovc1.exeFor 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.aspand then click How to use the Microsoft Download Center.
After extracting the project (by running ADOVC1.exe), open the project with Visual C++. Change "DefaultDir=C:\\test;" in the connection string to the directory where the files are, or move the Authors.mdb file to the "C:\test" directory. There is also a connection string to the Pubs database if you have SQL Server 6.5 or 7.0. The CREATEiNSTANCE macro is used to create the ADO Connection and Recordset objects. If the creation fails, the macro throws a _com_error exception, which is caught in the catch statement that wraps the code body. If ADO is not installed in the default directory, you must change the #import statement to reflect its actual location. It is not necessary to use the absolute path for the ADO .dll file. You can add the path to Visual Studio IDE from the Tools menu under Options. Click the Directory tab and add the path to the Library files list, which allows you to use the statement:
You can read about the #import directive in the Visual C++ programmer's guide. Although the sample program is only one page long, it covers all the basics of ADO from C++, without negelecting error handling. REFERENCESFor additional information, please see the following articles in the Microsoft Knowledge Base: Q182389 FILE: Adovcbm.exe ADO 1.5 with #import and Getrows/Bookmarks Q184968 FILE: Adovcsp.exe Demonstrates Using Stored Procedures with ADO Q186387 SAMPLE: Ado2atl.exe Returns ADO Interfaces from COM Q181733 FILE: Adovcbtd.exe #import Using UpdateBatch and CancelBatch Q200122 SAMPLE: ATL2ADO Returns Disconnected ADO Recordset Additional query words:
Keywords : kbfile kbsample kbADO kbADO210 kbDatabase kbOLEDB kbVC600 kbGrpVCDB kbGrpMDAC |
Last Reviewed: November 13, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |