Microsoft KB Archive/189997

= SRVRS.exe Uses VC++ to Get & Manipulate RDS Recordset =

Article ID: 189997

Article Last Modified on 3/2/2005

-

APPLIES TO


 * Microsoft Remote Data Services 1.5

-



This article was previously published under Q189997



SUMMARY
Srvrs.exe is a sample that demonstrates how to use Visual C++ to retrieve a recordset from an Remote Data Services (RDS) Server, make changes, and add the changes to the base table on the data server.



MORE INFORMATION
The following file is available for download from the Microsoft Download Center:

SRVRS.exe

To use Srvrs.exe, you must have an RDS client and an RDS server set up, and the server must have an ODBC Data Source Name (DSN) defined that points to a SQL Server. Srvrs.exe uses the authors table in the pubs database that comes with SQL Server. In Srvrs.exe, go to the main function in the .cpp file. Change the bstrServer variable to point to your RDS server and the bstrConnect to point to your DSN.

To install Srvrs.exe, create a new folder on your RDS client machine. Save Srvrs.exe in that folder, and run Srvrs.exe to extract the serverRS.cpp file. Open the serverRS.cpp file in Visual C++ and make the modifications to the bstrConnect and bstrServer strings. You might also need to check that the path in the #import directives is correct for your computer. On the Build menu, click Build. When a dialog box appears asking if you want to create a new default workspace, click Yes.

NOTE: To use Srvrs.exe with RDS 1.5, you must change all references to IdataSpacePtr in the .cpp file to DIDataSpacePtr. To use Srvrs.exe with RDS 2.0, do not change the code.

Also note that the record that is added is hard coded in Srvrs.exe. If you run Srvrs.exe more than once, you need to either change the primary key in the code or delete the record from the table in SQL Server. Otherwise, the Addnew fails because you are trying to add a duplicate record.

The details of Srvrs.exe are explained in the code comments.

This sample is an extension and expansion of the ideas and code in 178845. However, this sample is a small, complete app, which makes it easier for testing and experimentation.

Additional query words: kbRDS

Keywords: kbinfo kbdownload kbfile kbsample KB189997

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.