Microsoft KB Archive/183628

= How To Use the RDS DataFactory Through Standard ADO Open Method =

Article ID: 183628

Article Last Modified on 5/10/2006

-

APPLIES TO


 * Microsoft Remote Data Services 2.0
 * Microsoft Remote Data Services 1.5
 * 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 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:

http://msdn.microsoft.com/dataaccess

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.



Step-by-Step Example
NOTE: The following assumes that MDAC has been installed.  Start a Standard Visual Basic EXE project. 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.  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. 

