118 lines
6.8 KiB
HTML
118 lines
6.8 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=Windows-1252">
|
|
<TITLE>Remote Data Binding with Remote Data Service</TITLE>
|
|
<SCRIPT LANGUAGE="JavaScript">
|
|
<!--
|
|
TempString = navigator.appVersion
|
|
if (navigator.appName == "Microsoft Internet Explorer"){
|
|
// Check to see if browser is Microsoft
|
|
if (TempString.indexOf ("4.") >= 0){
|
|
// Check to see if it is IE 4
|
|
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/coua.css">');
|
|
}
|
|
else {
|
|
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/cocss.css">');
|
|
}
|
|
}
|
|
else if (navigator.appName == "Netscape") {
|
|
// Check to see if browser is Netscape
|
|
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/coua.css">');
|
|
}
|
|
else
|
|
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/cocss.css">');
|
|
//-->
|
|
</script>
|
|
<SCRIPT LANGUAGE="VBScript">
|
|
<!--
|
|
Sub Window_OnLoad()
|
|
Dim frmContents
|
|
On Error Resume Next
|
|
If Not Parent Is Nothing Then
|
|
Set frmContents = Parent.Contents
|
|
If Not frmContents Is Nothing Then
|
|
frmContents.Window.TOCSynch_Click
|
|
End If
|
|
End If
|
|
End Sub
|
|
//--></SCRIPT><META NAME="DESCRIPTION" CONTENT="Internet Information Services reference information">
|
|
<META HTTP-EQUIV="PICS-Label" CONTENT='(PICS-1.1 "<http://www.rsac.org/ratingsv01.html>" l comment "RSACi North America Server" by "inet@microsoft.com <mailto:inet@microsoft.com>" r (n 0 s 0 v 0 l 0))'>
|
|
<META NAME="MS.LOCALE" CONTENT="EN-US">
|
|
<META NAME="MS-IT-LOC" Content="Internet Information Services">
|
|
</HEAD>
|
|
|
|
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
|
|
|
|
<H1><A NAME="_k2_remote_data_binding_with_remote_data_service"></A><SUP></SUP>Remote Data Binding with Remote Data Service</H1>
|
|
|
|
<P>If your Web application provides clients with the ability to access data, you can distribute the processing of that data between the client and the server with Remote Data Service (RDS). Client-side RDS components send queries to the Web server. The server-side RDS components process these requests and send them to the Database Management System (DBMS) by use of a business object. The DBMS responds to the request, sending back the data to the Web server. The RDS components on the Web server transform that data into an ADO <B>Recordset</B> object. The data is parsed for transport to the client and sent back across the network to the client computer where it may be displayed in data-aware controls, such as a text or combo box.</P>
|
|
|
|
<P>The two main objects that you will use to accomplish remote data binding are <B>RDS.DataControl</B> and <B>RDS.DataFactory</B>. First, create a copy of the <B>RDS.DataControl</B> object on the client computer by inserting an object tag in an HTML page. For example:</P>
|
|
|
|
<PRE><CODE><OBJECT CLASSID="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33" ID="RDSDC1">
|
|
<PARAM NAME="SQL" VALUE="SELECT Author, ID FROM Authors">
|
|
<PARAM NAME="CONNECT" VALUE="DSN=Pubs;">
|
|
<PARAM NAME="SERVER" VALUE=http://Bookweb/>
|
|
</OBJECT>
|
|
</CODE></PRE>
|
|
|
|
<P>The preceding object tag creates an instance of the <B>RDS.DataControl</B> object and sets the SQL, Connect, and Server parameters for it. If you add this tag to an HTML page, you could then bind the data control object to multiple data-aware controls on the HTML page. For example, the following HTML tags display an HTML table that is bound to the above <B>RDS.DataControl</B> object.</P>
|
|
|
|
<PRE><CODE><TABLE id=Tasks DataSrc=#RDSDC1 WIDTH=100% BORDER=1 style="display: none">
|
|
<THEAD ALIGN=left>
|
|
<TR>
|
|
<TH><em>ID</TH>
|
|
<TH><em>Author</TH>
|
|
</TR>
|
|
</THEAD>
|
|
<TR>
|
|
<TD><DIV DATAFLD=ID></DIV></TD>
|
|
<TD><DIV DATAFLD=Author></DIV></TD>
|
|
</TR>
|
|
</TABLE>
|
|
</CODE></PRE>
|
|
|
|
<P>The object on the server that communicates with the <B>RDS.DataControl</B> object is either the <B>RDS.DataFactory</B>, or a business component. You can instantiate the <B>RDS.DataFactory</B> object by first creating a <B>RDS.DataSpace</B> object on the client, which then creates an instance of the <B>DataFactory</B> object on the server with the <B>CreateObject</B> method. The following example script demonstrates this process.</P>
|
|
|
|
<P>If your data access needs cannot be served by the <B>RDS.DataFactory</B> object, you can either a create a custom business component to communicate with the client, or you can use ADO directly from your ASP script to retrieve the data. In the following example, the custom business component, Inventory, exposes a method called <B>getQuantityonHand</B>. The <B>RDS.DataControl</B> object creates an instance of <B>Inventory</B> on the server, and then calls the <B>getQuantityonHand</B> method to retrieve records.</P>
|
|
|
|
<PRE><CODE><HTML>
|
|
<HEAD>
|
|
</HEAD>
|
|
<BODY>
|
|
<!-- RDS.DataControl -->
|
|
<OBJECT classid="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33" ID=ADC1></OBJECT>
|
|
<!-- RDS.DataSpace -->
|
|
<OBJECT ID="ADS1" WIDTH=1 HEIGHT=1 CLASSID="CLSID:BD96C556-65A3-11D0-983A-00C04FC29E36">
|
|
</OBJECT>
|
|
|
|
<SCRIPT LANGUAGE="VBScript">
|
|
Option Explicit
|
|
Sub GetRecords()
|
|
Dim objInventory, myRS
|
|
Set objInventory =
|
|
ADS1.CreateObject("Company.Inventory", _
|
|
"http://<%=Request.ServerVariables("SERVER_NAME")%>")
|
|
' Inventory exposes a method called
|
|
' getQuantityonHand that takes connection string and SQL parameters.
|
|
Set myRS = objInventory.getQuantityonHand _
|
|
("DSN=pubs;UID=sa;PWD=permission;","Select Quantity From Inventory")
|
|
' Assign the returned recordset to SourceRecordset.
|
|
ADC1.SourceRecordset = myRS
|
|
End Sub
|
|
</SCRIPT>
|
|
</BODY>
|
|
</HTML>
|
|
</CODE></PRE>
|
|
|
|
<P>The same issues that are described in <B>Component Design Guidelines</B>, in the IIS documentation in the Platform SDK, apply to any custom data business components you create to communicate with <B>RDS.DataControl</B>. For example, you should make sure that the component supports either the Apartment or Both threading model.</P>
|
|
|
|
<P><span class=le><B>Note </B></span>Remote Data Service (RDS) replaces the Advanced Data Connector (ADC), which is now considered obsolete. In particular, the ADC remoting functionality (the ability to manipulate and modify sets of records on the client) has been integrated into ADO as RDS.</P>
|
|
|
|
<P>For more information, see the Remote Data Service documentation in the Platform SDK.</P>
|
|
<hr class="iis" size="1">
|
|
<p align="center"><em><a href="../../../common/colegal.htm">© 1997-2001 Microsoft Corporation. All rights reserved.</a></em></p>
|
|
</BODY>
|
|
</HTML>
|