Microsoft KB Archive/182442

= FILE: Adomts.exe Shows Using ADO an MTS Component via DCOM =

Article ID: 182442

Article Last Modified on 8/9/2004

-

APPLIES TO


 * Microsoft ActiveX Data Objects 1.5
 * Microsoft ActiveX Data Objects 2.0
 * Microsoft ActiveX Data Objects 2.1 Service Pack 2
 * Microsoft ActiveX Data Objects 2.5
 * Microsoft ActiveX Data Objects 2.6
 * Microsoft ActiveX Data Objects 2.7
 * Microsoft Visual Basic 5.0 Professional Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 5.0 Enterprise Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q182442



SUMMARY
Adomts.exe is a sample that demonstrates how to use 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 an MTS-hosted DLL and retrieve an ADOR recordset through 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 DLLs to reside on the client.

The Server DLL has also been tested as a COM+ component that is hosted on a Windows 2000 server. Although the steps to create the DLL and client are identical, the steps to create and export the COM+ component are different. To configure a DLL as a COM+ component, follow these steps:
 * 1) In Control Panel, click Administrative Tools, and then click Component Services.
 * 2) Create the component as a Server Application.
 * 3) Before you export the component, right-click My Computer in the Component Services console, and then click Properties. On the Options tab, type the server's computer name in the Application Proxy RSN text box, and then click OK.
 * 4) Export the Component as an Application Proxy.



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

ADOMTS.EXE

For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:

119591 How to Obtain Microsoft Support Files from Online Services

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

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 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: ADOMTS RDS remote oleserver

Keywords: kbhowto kbdownload kbdatabase kbfile KB182442

-

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

© Microsoft Corporation. All rights reserved.