How To Use the RDS DataFactory Through Standard ADO Open Method (183628)



The information in this article applies to:

  • Remote Data Service for ADO 2.7
  • Remote Data Service for ADO 1.5
  • Remote Data Service for ADO 2.1 SP2
  • Remote Data Service for ADO 2.5
  • Remote Data Service for ADO 2.6

This article was previously published under Q183628

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 Microsoft Web site: 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. 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. Other system DSNs may be used instead, for example, a system DSN for SQL Server. This assumes that IIS Server is installed and running on the Remote Server. Note that this is a DSN on the server, not on the client.
       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. Later versions of MDAC may not install this database and the dsn. Create your own system dsn for an Access database on the server.

REFERENCES

For additional information, please see the following Web site: For additional information, please click the article number below to view the article in the Microsoft Knowledge Base:

184237 PRB: Unable to Open Registry Key DriverID Error with Advworks


Modification Type:MajorLast Reviewed:5/10/2006
Keywords:kbhowto KB183628