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

ID: Q189997

The information in this article applies to:

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 Software Library:

 ~ Srvrs.exe (size: 22077 bytes) 

Release Date: Jul-23-1998

For more information about downloading files from the Microsoft Software Library, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q119591
   TITLE : How to Obtain Microsoft Support Files from Online Services

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 Q178845. However, this sample is a small, complete app, which makes it easier for testing and experimentation.

Additional query words: kbRDS

Keywords          : kbfile kbsample
Version           : WINDOWS:1.5;
Platform          : WINDOWS
Issue type        : kbhowto

Last Reviewed: February 2, 1999