FILE: Adomts.exe Shows Using ADO w/ an MTS component via DCOM

Last reviewed: March 17, 1998
Article ID: Q182442
The information in this article applies to:
  • Microsoft Visual Basic Control Creation, Professional, and Enterprise Editions for Windows, version 5.0
  • ActiveX Data Objects (ADO)

SUMMARY

Adomts.exe is a sample that demonstrates using ActiveX Data Objects (ADO) to pass a disconnected recordset from a Microsoft Transaction Server (MTS) hosted DLL to a remote client via a Distributed Component Object Model (DCOM).

This article demonstrates how to use a lightweight Standard .exe client to connect to a MTS hosted DLL and retrieve an ADOR recordset via DCOM. This sample does not use Remote Data Service (RDS) to create the business objects.

The code included here demonstrates using both the Connection.Execute and the RecordSet.Open methods to create the ADODB recordset on the server and then passes a disconnected ADOR recordset back to the client. This eliminates the need for the ADODB DLL's to reside on the client.

MORE INFORMATION

The following file is available for download from the Microsoft Software Library:

 ~ Adomts.exe (size: 40589 bytes) 

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

Visual Basic ADO / MTS - DCOM Sample Readme.txt File

This sample demonstrates using ADO to pass a disconnected recordset from an MTS hosted DLL to a remote client via DCOM.

The file mentioned here is a self-extracting zip file that creates a folder named ADOMTS with separate client and server subfolders. The source code for each project can be found in the project's corresponding folder.

Steps to Run the Sample File

  1. The server folder contains the ActiveX DLL project for use with Microsoft Transaction Server (MTS) 1.1 or greater. Open the server project file Adomts.vbp.

  2. Change the <yourservername> placeholder in both connect strings to your SQL server's name.

  3. Compile the DLL and then exit the project.

  4. Add the DLL to a package in MTS using the MTS Explorer or Microsoft Management Console.

  5. Disable the authorization checking for this sample.

  6. The client folder contains a standard .exe client project that makes remote calls to the MTS component. Open the client project DcomADOClient.vbp.

  7. Set a reference to the server component in the projects references. Run the client project.

  8. The client demonstrates two different ways to handle the ADO connection. The first uses the Connection.Execute method while the second uses the RecordSet.Open method. Click the "GetAdoRecordset Con.Execute" button or the "GetAdoRecordset Rs.Open" button. This retrieves the disconnected ADO recordset from the server.

  9. Click the "Fill List from ADO Recordset" command button. This populates the list box, using the ADO recordset, with all the Authors names from the pubs database.

  10. Click the "Clear List" command button and then the "Fill List from ADO Recordset" button again. Note that the recordset is still intact and resides on the client machine. Also note that the MTS component has disconnected and is no longer needed to manipulate the ADO recordset.

How Microsoft Transaction Server (MTS) Handles DCOM

  1. Move the client to another computer.

  2. In the MTS Microsoft Management Console, find your package under "Packages Installed", right-click the package name and then select export.

  3. Move the .exe that was built by selecting export to the client.

  4. Double-click the exported .exe. This registers the MTS component.

  5. Now, run the client project. If you want to verify that your client is accessing the component on the server, go to the server and open the Microsoft Management Console. Drill down to the components section of the package you just installed. Run the client program again and watch for the ball beside the component name to start spinning.


Additional query words: RDS remote oleserver
Keywords : kbfile
Version : WINDOWS:5.0
Platform : WINDOWS
Issue type : kbhowto


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: March 17, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.