Article ID: 181733 - Last Review: August 11, 2006 - Revision: 3.3 Adovcbtd.exe #import Using UpdateBatch and CancelBatchThis article was previously published under Q181733 SUMMARY
The Adovcbtd.exe sample demonstrates CancelBatch, UpdateBatch, AddNew,
Delete, Move, and other ActiveX Data Objects (ADO) Recordset methods using
smart pointers and #import. Using #import is the preferred way for Visual
C++ programmers to use ADO.
The program is written and designed to demonstrate how to get started with ADO via #import. MORE INFORMATIONThe following file is available for download from the Microsoft Download Center: ADOVCBTD.exe
(http://download.microsoft.com/download/vc50pro/sample4/1/win98/en-us/adovcbtd.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.
The sample undefines EOF in Stdafx.h to prevent a conflict. The following three lines are from the Stdafx.h file: Msado15.dll has to be located on the same drive as the Windows System directory, and in a path \program files\common files\system\ado. You can configure Visual C++ to use this path to search for the ADO .dll, eliminating the need to specify the explicit path within your #import statement, just as you would configure the location of header files used by The sample shows what ADO capabilities are supported by the driver and also uses a Microsoft Access database. However, you can replace it with other data sources in the code. With certain combinations of Delete/Add New/Next/Prev, it is possible to get an OLE error. The code is provided as a sample only and is not for production purposes. NOTE: You cannot pass a connection object in the recordset Open methodin ADO version 1.5. You must use the PutRefActiveConnection method. Thisdiffers from ADO 1.0 and Visual Basic (VB). The following code shows how to open a recordset using an ODBC Data Source Name (DSN). The sample file opens the recordset using an alternate (DSN-less) method. Note that error checking has been omitted for clarity in the code given below, but is included in the sample file. Here is the code: For additional information about running the sample file, please refer to the Readme.txt file included with the sample. REFERENCES
For additional information on using ADO with #import, please see the
following articles in the Microsoft Knowledge Base:
For additional information184968, click the article numberFILE: Adovcsp.exe Demonstrates Using Stored Procedures with ADO below
to view the articleFILE: Adovcsp.exe Demonstrates Using Stored Procedures with ADO in the Microsoft Knowledge Base:
%3
(http://support.microsoft.com/kb/%3/EN-US/
)
%4
220152
(http://support.microsoft.com/kb/220152/EN-US/
)
FILE: Sample: ADOVC1 Simple ADO/VC++ Application
200122
(http://support.microsoft.com/kb/200122/EN-US/
)
SAMPLE: ATL2ADO Returns disconnected recordset from COM to VB
229088
(http://support.microsoft.com/kb/229088/EN-US/
)
SAMPLE: Vcspnp.exe Demonstrates Passing SQL NULL Parameters and Reading NULL Values with ADO
APPLIES TO
| Article Translations
|
Back to the top
