Article ID: 220152 - Last Review: August 10, 2004 - Revision: 2.3 Sample: ADOVC1 Simple ADO/VC++ ApplicationThis article was previously published under Q220152 SUMMARY The 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: Adovc1.exe
(http://download.microsoft.com/download/vc60pro/sample/1/win98/en-us/adovc1.exe)
For
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.
Collapse this table
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: Although the sample program is only one page long, it covers all the basics of ADO from C++, without negelecting error handling. REFERENCES For additional information, please see the following
articles in the Microsoft Knowledge Base: 182389
(http://support.microsoft.com/kb/182389/EN-US/
)
FILE: Adovcbm.exe ADO 1.5 with #import and Getrows/Bookmarks
184968
(http://support.microsoft.com/kb/184968/EN-US/
)
FILE: Adovcsp.exe Demonstrates Using Stored Procedures with ADO
186387
(http://support.microsoft.com/kb/186387/EN-US/
)
SAMPLE: Ado2atl.exe Returns ADO Interfaces from COM
181733
(http://support.microsoft.com/kb/181733/EN-US/
)
FILE: Adovcbtd.exe #import Using UpdateBatch and CancelBatch
200122
(http://support.microsoft.com/kb/200122/EN-US/
)
SAMPLE: ATL2ADO Returns Disconnected ADO Recordset
APPLIES TO
| Article Translations
|

Back to the top
