HOWTO: Using the RDS DataFactory via Standard ADO Open Method

ID: Q183628


The information in this article applies to:


SUMMARY

RDS (Remote Data Service for ADO), is tightly integrated with ActiveX Data Objects (ADO), and is included in the Microsoft Data Access Components (MDAC). MDAC can be downloaded from the following Web site:

http://www.microsoft.com/data

You do not need to use specific RDS code to get to the RDS DataFactory on your HTTP server through conventional ADO code. The example below shows how to access the RDS DataFactory using the ADO Open Method.


MORE INFORMATION

Step-by-Step Example


NOTE: The following assumes that MDAC has been installed.
  1. Start a Standard Visual Basic EXE project.


  2. 2. From the Project menu, choose References, and select the Microsoft ActiveX Data Objects Library that corresponds to the version of MDAC you have installed. Under Project Components, select the Microsoft FlexGrid Control.


  3. Add a FlexGrid control and a Command button to the Visual Basic Form. Paste the following code into the Command button's Click event:

    NOTE: Change the ServerXX, Select statement and data source name (DSN) if needed. The DSN is a System DSN for Microsoft Access. A system DSN for SQL Server may be used instead.
    
       Private Sub Command1_Click()
        Dim rs As New ADODB.Recordset
         rs.Open "Select * from Products", _
          "Provider=MS Remote;Remote Server=http://ServerXX;DSN=Advworks"
            While Not rs.EOF
          MSFlexGrid1.AddItem rs(0) & vbTab & rs(1)
            rs.MoveNext
           Wend
       End Sub
     
    The preceding sample code uses the Advworks DSN that uses the Microsoft Access driver to access the Advworks database that installs with the MDAC components. The MDAC installation at times has problems creating the DSN correctly. If the following error occurs remove the Advworks DSN and recreate the DSN through the ODBC Data Source Administrator located in Control Panel:

    Run-time error -2147467259(80004005) General Error Unable to Open registry key DriverID.
    The Advworks Microsoft Access database is located in:
    C:\Program Files\Common Files\System\MSadc\Samples\Advworks.mdb



REFERENCES

For additional information, please see the following Web site:

http://www.microsoft.com/data/rds/

Additional query words: kbdse


Keywords          : kbADO150 kbADO200 kbRDS150 kbRDS200 
Version           : WINDOWS:1.5
Platform          : WINDOWS 
Issue type        : kbhowto 

Last Reviewed: February 11, 1999