Adomts.exe Shows Using ADO an MTS Component via DCOM

ID: Q182442


The information in this article applies to:
  • ActiveX Data Objects (ADO), versions 1.5, 2.0, 2.1 SP2
  • Microsoft Visual Basic Control Creation, Professional, and Enterprise Editions for Windows, version 5.0
  • Microsoft Visual Basic Professional and Enterprise Editions for Windows, version 6.0


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 Download Center. Click the file name below to download the file:

ADOMTS.EXE
For more information about how to download files from the Microsoft Download Center, please visit the Download Center at the following Web address
http://www.microsoft.com/downloads/search.asp
and then click How to use the Microsoft Download Center.

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. In clsADORec, change the <yourservername> placeholder in both connect strings in GetAdoRecordset and GetAdoRecordset2 to your SQL server's name.


  3. From the Project menu, select References, change the reference to your current version of ADO and ADOR.


  4. Compile the DLL and then exit the project. Do not make this project compatible with the ADOMTS.DLLs that come with ADOMTS.EXE. These DLLs have were designed to be compatible with ADO 1.5 only.


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


  6. Disable the authorization checking for this sample.


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


  8. From the Project menu, select References, and change the reference to your current version of ADO and ADOR.


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


  10. 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.


  11. 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.


  12. 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 kbADO200 kbDatabase kbMTS kbGrpVBDB kbGrpMDAC kbDSupport kbADO210sp2
Version : WINDOWS:1.5,2.0,2.1 SP2,5.0,6.0
Platform : WINDOWS
Issue type : kbhowto


Last Reviewed: November 13, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.