Article ID: 184968 - View products that this article applies to.
This article was previously published under Q184968
This article has been archived. It is offered "as is" and will no longer be updated.
Adovcsp.exe is a sample program that demonstrates opening keyset and forwardOnly cursors using ActiveX Data Objects (ADO) Recordsets by executing stored procedures on Microsoft SQL Server. It also shows how to open a disconnected record set. The sample uses the Visual C++ #import feature and demonstrates ADO Recordset GetState(), Parameters GetName() and GetValue(), and many other Recordset, Command and Connection methods.
The following file is available for download from the Microsoft Download Center:
ADOVCSP.EXERelease Date: September 17, 2003
For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:
119591Microsoft 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.
(https://support.microsoft.com/kb/119591/ )How to Obtain Microsoft Support Files from Online Services
The application assumes that you have a Microsoft SQL Server installed with the sample Pubs database. If this is not the case, change the following code in the openConn function:
Replace Data Source=serverName with the name of your server and specify the name of your database. The sample creates two stored procedures and a table, and then drops them when the application exits.
The OpenRd method takes an input parameter (GradYear) and passes it to the stored procedure sp_AdoTestInOut. sp_AdoTestInOut returns all the records with GradYear >= to the parameter passed. It returns an output parameter, the number of records returned and also returns a parameter (the max GradYear). The student table created is based on the Student table of the Student Enrollment database that ships with Visual C++.
In this sample, the text boxes to show the Output parameter and Return code are only used when running the stored procedure by clicking the OpenRead button. Please see the source code for more details.
The Supports button obtains the schema information from the database using the technique and code described in the following Microsoft Knowledge Base article:
182831The Open DisCon button opens a disconnected recordset. This code is taken from the following Microsoft Knowledge Base article:
(https://support.microsoft.com/kb/182831/EN-US/ )HOWTO: Using the ADO OpenSchema Method from Visual C++
(https://support.microsoft.com/kb/184397/EN-US/ )HOWTO: Getting ADO Disconnected Recordsets in VBA/C++/Java
For additional information, click the following article numbers to view the articles in the Microsoft Knowledge Base:
(https://support.microsoft.com/kb/182389/ )FILE: Adovcbm.exe ADO 1.5 with #import and Getrows/Bookmarks
(https://support.microsoft.com/kb/181733/ )FILE: Adovcbtd.exe #import Using UpdateBatch and CancelBatch
(https://support.microsoft.com/kb/220152/EN-US/ )FILE: Sample: ADOVC1 Simple ADO/VC++ Application
(https://support.microsoft.com/kb/200122/EN-US/ )SAMPLE: ATL2ADO returns disconnected recordset from COM to VB
(https://support.microsoft.com/kb/229088/EN-US/ )SAMPLE: Vcspnp.exe Demonstrates Passing SQL NULL Parameters and Reading NULL Values with ADO
Article ID: 184968 - Last Review: February 23, 2014 - Revision: 5.3