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



The information in this article applies to:

  • Remote Data Service for ADO 1.1
  • Remote Data Service for ADO 1.5
  • Remote Data Service for ADO 2.0
  • Remote Data Service for ADO 2.1 SP2
  • Remote Data Service for ADO 2.5
  • Remote Data Service for ADO 2.6
  • Remote Data Service for ADO 2.7
  • Microsoft Visual Basic Professional Edition for Windows 5.0
  • Microsoft Visual Basic Professional Edition for Windows 6.0
  • Microsoft Visual Basic Enterprise Edition for Windows 5.0
  • Microsoft Visual Basic Enterprise Edition for Windows 6.0

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.

MORE INFORMATION

Create the Visual Basic ActiveX Document Client

  1. Create a new Visual Basic (VB) ActiveX Document EXE project. Select the Project and name the project Rdsclient.
  2. Place a Command button on the form.
  3. 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://<Server>")
    
          '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
    					
  4. Change the <Server> code to reflect the Internet Information Server (IIS) server where the ActiveX document and the RDS Server components will reside.
  5. Save and compile the the ActiveX Document Project.

Creating an Internet Download Setup for the ActiveX Document

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. On the ActiveX Server Components screen, click Next.
  6. Accept the default files for distribution and click Next. In Visual Basic 6.0 you have already done this on a previous screen.
  7. Click Finish.
  8. 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.
  9. Access the .htm file from the Browser through http as follows:

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

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

REFERENCES

For additional information, see the following Microsoft Web sites:
For additional information, see the following article or articles in the Microsoft Knowledge Base:

168428 How To Test Your ActiveX Documtnets (.VBD)

199017 HOWTO Deploy Visual Basic IIS Applications with PDW


Modification Type:MinorLast Reviewed:3/14/2005
Keywords:kbDatabase kbhowto kbMDACNoSweep KB184630