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
- 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.
- Change the <yourservername> placeholder in both connect strings to your
SQL server's name.
- Compile the DLL and then exit the project.
- Add the DLL to a package in MTS using the MTS Explorer or Microsoft
Management Console.
- Disable the authorization checking for this sample.
- The client folder contains a standard .exe client project that makes
remote calls to the MTS component. Open the client project
DcomADOClient.vbp.
- Set a reference to the server component in the projects references. Run
the client project.
- 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.
- 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.
- 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
- Move the client to another computer.
- In the MTS Microsoft Management Console, find your package under
"Packages Installed", right-click the package name and then select
export.
- Move the .exe that was built by selecting export to the client.
- Double-click the exported .exe. This registers the MTS component.
- 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.