How To Use a Remote Data Service (RDS) Handler with an RDS Data Control (266886)



The information in this article applies to:

  • Remote Data Service for ADO 2.0
  • Remote Data Service for ADO 2.1
  • Remote Data Service for ADO 2.5
  • Microsoft Data Access Components 2.0
  • Microsoft Data Access Components 2.1
  • Microsoft Data Access Components 2.5

This article was previously published under Q266886

SUMMARY

Beginning with Microsoft Data Access Components (MDAC) version 2.0, the Remote Data Services (RDS) components support the concept of an RDS handler. By using RDS handlers, you hide the actual connection string and query string from the user.

You can take advantage of RDS handlers by setting the Handler property of the RDS.DataControl object. The documentation is not entirely clear on this subject; this article provides a simple example of how to create your own handler to be used with the RDS.DataControl object.

MORE INFORMATION

To create your handler, perform the following steps:
  1. Create an .ini file for the RDS handler. For example, the following .ini file defines the "MyDatabase" data source to connect to the ODBC data source name (DSN) "MyServer":
    [connect MyDatabase]
    Access=ReadWrite
    Connect="DSN=MyServer"
    
    [sql authors]
    ;If we want to disable unknown SQL values, we set Sql to an invalid query.
    Sql="select * from pubs.dbo.authors"
    						
    Notice the use of the Handler property for the control, and the use of the handler names "MyDatabase" and "authors". "MyDatabase" is defined in the Connect item of the .ini file as "authors", which will hold the SQL select to be used.
  2. Place the .ini file in the Winnt folder of the RDS Server computer.
  3. Create the object tag in HTML for the RDS data control. It should resemble the following:
    <HTML>
    <BODY>
    <OBJECT CLASSID="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33"
            ID="dsoData" HEIGHT="0" WIDTH="0">
      <PARAM NAME="Server" VALUE="http://MyIISServer">
      <PARAM NAME="Connect" VALUE="Data source=MyDatabase">
      <PARAM NAME="Handler" VALUE="MSDFMAP.Handler,dfmap.ini">
      <PARAM NAME="SQL" VALUE="authors">
    </OBJECT>
    
    <TABLE ID="tblData" DATASRC="#dsoData" BORDER=1>
      <TR><TD><INPUT TYPE="TEXT" DATAFLD="au_id"></TD></TR>
    </TABLE>
    </BODY>
    </HTML>
    					
  4. In the .ini file, replace "MyServer" with the name of your DSN.
  5. In the HTML object tag, replace "MyIISServer" with the name of your server.

REFERENCES

230680 INFO: Working with RDS Handlers


Modification Type:MinorLast Reviewed:7/13/2004
Keywords:kbhowto KB266886