Data Access and Transactions |
You can bind data-aware controls (for example, a DHTML text box, FlexGrid control, and so on) to data from remote servers, allowing you to view, edit, and update data from a Web page. RDS is only one of several data binding controls that can execute query results and bind them to other DHTML elements in Internet Explorer.
In RDS, the data-binding mechanism is the RDS.DataControl object. This is a nonvisual control that can bind a single ADO Recordset object, which represents the results of a query, to one or more data-aware controls on a Web page. It is possible to have more than one RDS.DataControl object on the page. The following HTML establishes a connection to the MySite server, and selects all the authors from the Pubs database:
<!-- RDS.DataControl -->
<OBJECT ID=RDS classid="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33">
<PARAM NAME="SQL" VALUE="Select * from Authors">
<PARAM NAME="SERVER" VALUE="http://MySite">
<PARAM NAME="CONNECT" VALUE="dsn=Pubs;UID=sa;PWD=;">
</OBJECT>
When you use the RDS.DataControl to obtain a disconnected Recordset, RDS calls the RDSServer.DataFactory object on the middle tier for you. You don’t need to call RDSServer.DataFactory or RDS.DataSpace explicitly.
When the RDS proxy invokes the RDSServer.DataFactory object on the server, the server-side object creates an ADO Recordset and executes the query against the specified data source. The results are then transmitted to the client where the RDS.DataControl reconstructs the Recordset for the client application. Once the data has been retrieved, the client disconnects from the data source. This helps to eliminate the contention for database connections that sometimes occurs as multiple clients simultaneously access the same data source.
The figure below shows a data-bound grid control in Internet Explorer. When the page loads, the grid control is automatically filled with records from the Adventure Works database. The following code listing shows the Microsoft® Visual Basic® Scripting Edition (VBScript) used to create this page. Note that very little of the script actually executes on the server; most of it operates using objects created on the client.
See the following example: Example: The Sheridan Grid Control