Data Access and Transactions

Previous Topic Next Topic

Example: The Sheridan Grid Control

The example uses the Sheridan data-bound grid control, which is available from the Sheridan Web site, http://www.shersoft.com, or as part of the MDAC samples. If you have installed the MDAC samples, the .cab file for the grid control can be found at http://<yourserver>msadc/Samples/ssdatb32.cab.

A Data-Bound Grid Control in Internet Explorer

<%@ LANGUAGE=VBScript EnableSessionState=False %>
<!-- #include file="adcvbs.inc" -->
<HTML>
  <HEAD>
    <TITLE>A databound grid control</TITLE>
  </HEAD>
  <BODY BGCOLOR=#FFFFFF TEXT="#000000">

    <!-- RDS.DataControl -->
    <OBJECT ID="DATA" WIDTH=1 HEIGHT=1
    CLASSID="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33">
    </OBJECT>
    <!-- Sheridan data-bound grid control (note DATASRC) -->
    <OBJECT ID="GRID" WIDTH=600 HEIGHT=200 DATASRC="#DATA"
    CLASSID="clsid:00028C00-0000-0000-0000-000000000046">
    </OBJECT>
    --><SCRIPT Language=VBScript>
    Sub Window_OnLoad
    If DATA.ReadyState <> <%=adcReadyStateComplete%> Then
    MsgBox "Query results still arriving, Please wait"
    Else
    DATA.Server  = "http://<%Request.ServerVariables("SERVER_NAME")%>"
    DATA.Connect = "DSN=AdvWorks"
    DATA.SQL     = "Select * from Products"
    DATA.Refresh
    GRID.Rebind
    End if
    END SUB
    </SCRIPT>
  </BODY>
</HTML>

Each RDS.DataControl object can be connected to a different data source and contain the results of a separate query. When you use the RDS.DataControl object to send a query to a database, the RDS server-side components return an ADODB.Recordset object to the client. On the client, the RDS proxy creates a client-side cursor and an ADOR.Recordset object to manipulate the returned records. You don’t necessarily have to write any ADO­specific code to make this happen—RDS handles this for you when you use the RDS.DataControl object.

The figure below shows how the client-side and server-side components of a Web-based ADO application work together to process a user’s query and display information from a database.

  1. The user enters the query text, chooses a preformatted request, or navigates to a page containing an embedded query.
  2. When an event fires on the Web page, such as the Window_OnLoad routine or OnClick event of a Search button, ADO creates a RDSServer.DataFactory proxy (or business object proxy) on the client.
  3. The proxy translates the user request into an HTTP request, by formatting the parameters of the business object method as URL parameters. It then sends the request to the Web server specified in the RDS.DataControl Server property. IIS 5.0 forwards the HTTP request to an Internet Server Application Programming Interface (ISAPI) extension.
  4. Advanced Data ISAPI (ADISAPI) interprets the URL parameters, creates an instance of the requested business object, and makes the method call. (By default, it calls the Query method of the server-side RDS.DataFactory object.)
  5. The RDS.DataFactory object executes the user’s query via OLE DB. It sets the CursorLocation property of the Recordset so that Cursor Service is used as its buffering component.
  6. OLE DB passes the complete results of the query to the Cursor Service, which populates its buffers with the data, including all of the metadata for tables that are part of the result set.
  7. The Client Cursor Engine passes a reference to the result set back to the RDS.DataFactory object.
  8. The RDS.DataFactory object creates an instance of an ADO Recordset and initializes it with the result set. The ADO Recordset is then passed back as the return value of the original Query call from step 4.
  9. The RDS.DataFactory object passes the Recordset back to ADISAPI, which packages the return value of the call into Multipurpose Internet Mail Extensions (MIME) format.
  10. ADISAPI sends the Recordset over HTTP as multipart MIME packets to the business object proxy on the client side.
  11. The client-side proxy unpacks the results of the method call, and recreates the Recordset in the client-side Data Cache.
  12. Finally, the embedded RDS.DataControl object binds the data in the client-side Data Cache to the visual controls.

    Process Diagram of an ADO Application Using RDS for Data Partitioning


© 1997-1999 Microsoft Corporation. All rights reserved.