Microsoft KB Archive/176874

= How To Distribute RDS Client with Visual Basic Setup Wizard =

Article ID: 176874

Article Last Modified on 3/14/2005

-

APPLIES TO


 * Microsoft Remote Data Services 2.0
 * Microsoft Remote Data Services 1.5
 * Remote Data Service for ADO 2.0
 * Microsoft Remote Data Services 2.1
 * Remote Data Service for ADO 2.5
 * Remote Data Service for ADO 2.6

-



This article was previously published under Q176874



SUMMARY
This article describes the steps to distribute the Remote Data Service (RDS) client files with a Visual Basic 5.0 application.

Starting with Microsoft Data Access Components (MDAC) 2.0, RDS has been incorporated into the Microsoft ActiveX Data Objects. RDS is now known as A Web Data Access Feature of ActiveX Data Objects.

All of the Microsoft Data Access Components are contained in a single redistributable, MDAC_TYP.EXE.

To ensure that your RDS clients have the RDS components, you should redistribute the proper version of the MDAC.

You can download the latest version of MDAC at the following Microsoft Web site:

http://msdn.microsoft.com/dataaccess

Note that MDAC 1.5 is no longer available for download.

Once you've downloaded MDAC_TYP.EXE, you have two options for redistributing it:  Include MDAC_TYP.EXE in your setup program.

For more information on distributing MDAC_TYP.EXE in your Setup program, please see the following article in the Microsoft Knowledge Base:

184265 How To Distribute ADO with the Application Setup Wizard

 Run the MDAC_TYP.EXE as a standalone program. Note that DCOM must be installed before MDAC is installed. While Windows 2000, Windows NT 4.0, and Windows 98 have DCOM built in, you should ensure that your Windows 95 clients have installed DCOM before installing MDAC. You can download the DCOM95 redistributable from the following site:

http://www.microsoft.com/com

Note that DCOM95 must be run as a standalone program. You cannot include it in your Setup program.



Step One
Build the Test Visual Basic application. Assume that you are building this application on a computer that already has the proper RDS client files installed.  Start a new Standard EXE project. Form1 is created by default. From the Project menu, select References, and then select Microsoft Remote Data Services Library. Add two CommandButtons to Form1, named Command1, and Command2 by default.  Paste the following code into the General Declarations section of Form1:

Note You must change Username= and PWD= to the correct values before you run this code. Make sure that Username has the appropriate permissions to perform this operation on the database. Private Sub Command1_Click 'DataControl MousePointer = vbArrowHourglass Dim dc As New RDS.DataControl dc.Connect = "dsn=pubs;Username= ;PWD= ;" 'dsn should be a system dsn dc.SQL = "select * from authors" dc.Server = "http://ServerXXXX" dc.ExecuteOptions = adcExecAsync dc.Refresh

While dc.ReadyState = 2 DoEvents 'user has control during async query Wend MousePointer = vbDefault MsgBox dc.Recordset.Fields(0).Value End Sub

Private Sub Command2_Click 'DataSpace, DataFactory MousePointer = vbArrowHourglass Dim ds As New RDS.DataSpace Dim df, rs  Set df = ds.CreateObject("RDSServer.DataFactory",   "http://ServerXXXX") Set rs = df.Query("dsn=pubs;Username= ;PWD= ;", "select * from authors") MsgBox rs.Fields(0).Value MousePointer = vbDefault End Sub </li> Change the Server, SQL, and Connect strings to match actual servers you will be testing against.</li> Save the project.</li> Run the project and test its functionality against your server to verify that it works. If it does not work at this time, do not continue to Step Two below until you have figured out what is wrong. The RDS documentation, Readme.txt, and other Microsoft Knowledge Base articles will help you debug RDS configuration problems.</li></ol>

Step Two
Build the distributable application using the Visual Basic Application Setup Wizard.
 * 1) Optionally, include MDAC_TYP.EXE in your Setup program. See the REFERENCES section of this article for more information.
 * 2) Whether you include MDAC_TYP.EXE in your Setup program or not, you do not need to include separate Remote Data components in your Setup program. So, when running the Application Setup Wizard, remove the reference to Microsoft Remote Data Services Library (msadco.dll). This file and all other RDS files are included in MDAC_TYP.EXE.
 * 3) On a computer that has never had any RDS files installed, test the functionality of your example program by running the Setup.exe file that the Application Setup Wizard created. Be sure that DCOM is installed prior to installing MDAC.

<div class="references_section">