Microsoft KB Archive/184630

= How To Create and Distribute an ActiveX Document with Remote Data Services (RDS) =

Article ID: 184630

Article Last Modified on 8/27/2007

-

APPLIES TO


 * Microsoft Remote Data Services 1.1
 * 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
 * Microsoft Remote Data Services 2.0
 * 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 Q184630



SUMMARY
This article explains how to create an ActiveX document that uses the Remote Data Services (RDS) of ActiveX Data Objects (ADO) and how to distribute the document to Microsoft Internet Explorer clients.



Create the Visual Basic ActiveX Document Client
 Create a new Visual Basic (VB) ActiveX Document EXE project. Select the Project and name the project Rdsclient. Place a Command button on the form.  Paste the following code into the General Declarations section of the project: Option Explicit

Private Sub Command1_Click Dim rs As Object  'Resultset Dim ds As Object  'RDS.DataSpace Dim df As Object  'RDSServer.DataFactory

Set ds = CreateObject("RDS.DataSpace") Set df = ds.CreateObject("RDSServer.DataFactory", _     "http://")

'This query returns a recordset over HTTP. Dim strCn As Variant, strSQL As Variant strCn = "dsn=asystemdsn" strSQL = "Select * from Products" Set rs = df.Query(strCn, strSQL) MsgBox rs(0)    'Print 1 to MsgBox End Sub  Change the  code to reflect the Internet Information Server (IIS) server where the ActiveX document and the RDS Server components will reside. Save and compile the the ActiveX Document Project.</ol>

Creating an Internet Download Setup for the ActiveX Document
<ol> Exit Visual Basic 5.0. Use the Application Setup Wizard to package the ActiveX document for Internet download. From the Start menu, select Programs, and then select Visual Basic 5.0 and click Application Setup Wizard. You can start the Package and Deployment Wizard distributed with Visual Basic 6.0 the same way or you can start it as an add-in within Visual Basic.</li> Choose Browse and select the ActiveX Document project that you just created. By default, the program saves the application to the location where Visual Basic is installed. The name of the file is RdsClient.vbp. Select the Create Internet Download Setup" option, and then click Next. The PDW asks you for a script name before you get to the screen where you select Internet Package.</li> Choose the destination location. This is where the setup files created by the Application Wizard are stored. The setup files consist of the .cab, .htm, .vbd files and a support folder. Visual Basic 6.0 creates a package subdirectory and place the .cab, .htm, and .vbd files in there. Click Next and you see a list of included files. Accept the default here.</li> Click Next and then choose Download from Microsoft Web site for the run-time components. Click the safety button, select the Safe for Initialization and Safe for Scripting check boxes, and then click OK. Click Next to continue to the next screen. In Visual Basic 6.0 these two items are on a the next screen called Safety Settings.</li> On the ActiveX Server Components screen, click Next.</li> Accept the default files for distribution and click Next. In Visual Basic 6.0 you have already done this on a previous screen.</li> Click Finish.</li> Copy the generated files (.cab, .htm, .vbd and the support folder) into the Webserver root directory. In Visual Basic 6.0 you can use the deploy button in the first screen of the PDW to accomplish the same thing.</li> Access the .htm file from the Browser through http as follows:

http://<IIS server>/RdsClient.htm

</li> You should be able to see the ActiveX document. Click the Command button and note that a message box showing the first recordset is displayed. NOTE: Because the component is not signed, you may see warnings regarding the download of the component. Before the actual distribution of your application, you should have the components signed.</li></ol>

<div class="references_section">