⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 3.htm

📁 IIS5.0超级管理手册-网页开发篇 书籍语言: 简体中文 书籍类型: 网页设计 授权方式: 免费软件 书籍大小: 262 KB
💻 HTM
📖 第 1 页 / 共 5 页
字号:
  <p><font face="arial" color="#000000" size="2" style="line-height: 25px">ADO和RDS适用於那些需要大量存取资料库的应用程式。在为企业内部网路开发一个应用程式时,您通常必须使用IIS 
  5.0和Internet 
  Explorer在用户端和商业服务层之间进行通讯。但是如果用户端和中间层元件存在於本机区域网路(LAN)中,您也可以使用COM跨越网路进行介面和方法参数的配置。RDS也可以被用Visual 
  Basic编写的应用程式进行远端资讯管理。</font></p>
  <p><font face="arial" color="#000000" size="2" style="line-height: 25px">有了RDS,ADO可使Web应用程式开发者能够:</font></p>
  <font face="arial" color="#000000" size="2" style="line-height: 25px">
  <ul style="line-height: 25px">
    <li style="line-height: 25px">透过DHTML「资料系结」模式将ADO<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;Recordset&nbsp;</b></font>物件和内含在浏览器中的Dynamic 
    HTML(DHTML)控制项(以及其他的资料感知控制项)结合在一起。<br style="line-height: 25px">
 </li>
    <li style="line-height: 25px">建立并管理远端以及中断的ADO Recordset物件。ADO通常会与资料库建立一个持久稳定的连线,而 
    RDS是透过本机快取记忆体的非连线资料来运作的。<br style="line-height: 25px">
 </li>
    <li style="line-height: 25px">非同步地向伺服器请求资讯,并对操作结束所触发的事件作出反应。非同步的资料索取是OLE 
    DB的Microsoft Cursor 
    Service的特有特性。它先为一个查询传回比较前面的记录,然後在使用者处理这些先被传回的资料时,在後端继续处理资料。<br style="line-height: 25px">
 </li>
    <li style="line-height: 25px">不透过HTTP和COM在Web伺服器上呼叫Automation物件。您可以在应用程式中使用RDS来浏览记录、连线到中间层或更改中间层资料。<br style="line-height: 25px">
 </li>
    <li style="line-height: 25px">使用分层和多维记录集。透过OLE DB的新Microsoft Data Shaping 
    Service(Microsoft Datashape),RDS克服了以前每个查询只能有一个结果集的限制。<br style="line-height: 25px">
 </li>
  </ul>
  </font>
  <p><font face="arial" color="#000000" size="2" style="line-height: 25px">RDS用户端和伺服器端元件将在後面的小节中详细描述。</font></p>
  <p><font face="arial" color="#3e72d7" size="4" style="line-height: 25px">
  <b style="line-height: 25px">用户端层元件<br style="line-height: 25px">
 </b></font></p>
  <p><font face="arial" color="#000000" size="2" style="line-height: 25px">
  如前章所述,用户端服务层为收集和显示提供了一个看得见的介面。在一个基於Web的RDS应用程式中,Web网页代表了RDS的前端。RDS用户端层包含以下元件:</font></p>
  <font face="arial" color="#000000" size="2" style="line-height: 25px">
  <ul style="line-height: 25px">
    <li style="line-height: 25px">一个包含一个<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;RDS.DataControl&nbsp;</b></font>物件和一或多个资料感知控制项的Web网页或 
    Visual Basic应用程式。<br style="line-height: 25px">
 </li>
    <li style="line-height: 25px">一个<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;RDS.DataSpace&nbsp;</b></font>物件和中间层商业物件的用户端代理。预设的商业物件是<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;RDSServer.DataFactory&nbsp;</b></font>,或是您也可以开发自订的商业物件。<br style="line-height: 25px">
 </li>
    <li style="line-height: 25px">一个OLE DB的资料快取记忆体和用户端资料指标引擎,即OLE DB的Cursor 
    Service。<br style="line-height: 25px">
 </li>
  </ul>
  </font>
  <p><font face="arial" color="#3e74d7" size="3" style="line-height: 25px">
  <b style="line-height: 25px">资料感知控制项<br style="line-height: 25px">
 </b></font></p>
  <p><font face="arial" color="#000000" size="2" style="line-height: 25px">
  您可以将资料感知控制项(例如,一个DHTML文字方块、FlexGrid控制项等等)与远端伺服器资料系结在一起,以观看、编辑和更新Web网页的资料。RDS是几种资料系结控制项中唯一可以查询结果并将它们与Internet 
  Explorer中另一类DHTML元件系结在一起的。</font></p>
  <p><font face="arial" color="#000000" size="2" style="line-height: 25px">在RDS中,资料系结装置是RDS.DataControl物件。这是一个看不见的控制项,它可以将一个提供查询结果的ADO 
  Recordset物件与网页上的一或多个资料感知控制项系结在一起。以下的HTML建立了一个与Mysite伺服器的连线,并查询了Pubs资料库中的所有作者。</font></p>
  <div style="line-height: 25px; background-color: #d7d7d7">
    <font face="Arial" size="3" style="line-height: 25px">
    <pre style="line-height: 25px">&lt;!-- RDS.DataControl -- &gt;
&lt; OBJECT ID=RDS classid=&quot;clsid:BD96C556-65A3-11D0-983A-00C04FC29E33&quot; &gt;
	&lt; PARAM NAME=&quot;SQL&quot; VALUE=&quot;Select from Authors&quot; &gt; 
	&lt; PARAM NAME=&quot;SERVER&quot; VALUE=&quot;http://MySite&quot; &gt;
	&lt; PARAM NAME=&quot;CONNECT&quot; VALUE=&quot;dsn=Pubs;UID=sa;PWD=;&quot; &gt; 
&lt;/ OBJECT &gt;</pre>
    </font>
  </div>
  <p><font face="arial" color="#000000" size="2" style="line-height: 25px">当使用<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;RDS.DataControl&nbsp;</b></font>获得一个中断的<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;Recordset&nbsp;</b></font>时,RDS会呼叫中间层的<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;RDSServer.DataFactory&nbsp;</b></font>物件。您不需要显式呼叫RDSServer.DataFactory 
  或 RDS.DataSpace。</font></p>
  <p><font face="arial" color="#000000" size="2" style="line-height: 25px">当RDS资料库代理呼叫伺服器上的<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;RDSServer.DataFactory&nbsp;</b></font>物件时,伺服器端物件会建立一个ADO 
  Recordset并对特定的资料来源进行查询。当<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;RDS.DataControl&nbsp;</b></font>为用户端应用程式重建Recordset时,查询结果被传送到用户端。一旦用户端收到资料,就与资料来源中断,这有助於减少对资料库连线的竞争,因为有时会发生多个用户端同时存取同一个资料来源的情况。</font></p>
  <p><font face="arial" color="#000000" size="2" style="line-height: 25px">
  图3-2展示了一个Internet Explorer中的资料系结方格控制项。当载入网页时,方格控制项被来自Adventure 
  Works资料库的资料自动填满。以下的程式码显示了用Microsoft Visual Basic Scripting Edition(VBScript)建立一个网页。请注意,事实上在伺服器上只执行了非常少量的指令档,大多数指令档是透过用户端建立的物件操作的。</font></p>
  <p><font face="arial" color="#3e78d7" size="2" style="line-height: 25px">
  <b style="line-height: 25px">范例:Sheridan方格控制项<br style="line-height: 25px">
 </b></font></p>
  <p><font face="arial" color="#000000" size="2" style="line-height: 25px">
  本例使用了Sheridan资料系结的方格控制项,它存在於Sheridan网站,&nbsp;</font></a><font face="arial" color="#000000" size="2" style="line-height: 25px"><a target="_new" href="http://www.shersoft.com" style="line-height: 25px">http://www.shersoft.com</a>&nbsp;,作为MDAC样本的一部分。如果您已经安装了MDAC样本,那麽便可以在http://&lt;您的伺服器&gt;msadc/Samples/ssdatb32.cab找到关於方格控制项的 
  .cab档案。</font></p>
  <p><br style="line-height: 25px">
 </p>
  <center style="line-height: 25px">
  <p>
  <input id="1" onclick="imgclick" type="image" src="http://e-msbooks.com/xmlfiles/957-2085-16-6/imagesh/F03dd02.gif" border="0" style="line-height: 25px"></p>
  </center><center style="line-height: 25px">
  <table border="0" style="line-height: 25px">
    <tbody style="line-height: 25px">
      <tr style="line-height: 25px">
        <td align="middle" style="line-height: 25px">
        <font face="arial" color="#000000" size="2" style="line-height: 25px">
        图3-2 一个Internet Explorer中的资料系结方格控制项</font></td>
      </tr>
  </table>
  </center>
  <div style="line-height: 25px; background-color: #d7d7d7">
    <font face="Arial" size="3" style="line-height: 25px">
    <pre style="line-height: 25px">&lt;%@ LANGUAGE=VBScript EnableSessionState=False % &gt;
&lt;!-- #include file=&quot;adcvbs.inc&quot; --&gt;
&lt; HTML &gt;
	&lt; HEAD &gt;
		&lt; TITLE &gt; A databound grid control &lt;/ TITLE &gt;
	&lt;/ HEAD &gt;
	&lt; BODY BGCOLOR=#FFFFFF TEXT=&quot;#000000&quot; &gt;

		&lt;!-- RDS.DataControl -- &gt;
		&lt; OBJECT ID=&quot;DATA&quot; WIDTH=1 HEIGHT=1
		CLASSID=&quot;clsid:BD96C556-65A3-11D0-983A-00C04FC29E33&quot; &gt;
		&lt;/ OBJECT &gt;
		&lt;!-- Sheridan data-bound grid control(note DATASRC)--&gt;
		&lt; OBJECT ID=&quot;GRID&quot; WIDTH=600 HEIGHT=200 DATASRC=&quot;#DATA&quot; 
		CLASSID=&quot;clsid:00028C00-0000-0000-0000-000000000046&quot; &gt;
		&lt;/ OBJECT &gt;
		--&gt; &lt; SCRIPT Language=VBScript &gt;
		Sub Window_OnLoad
		If DATA.ReadyState &lt;&gt; &lt;%=adc ReadyStateComplete% &gt; Then
		MsgBox &quot;Query results still arriving, Please wait&quot;
		Else
		DATA.Server = &quot;http:// &lt;% Request.ServerVariables(&quot; SERVER_NAME&quot;)%&gt;&quot;
		DATA.Connect = &quot;DSN=AdvWorks&quot;
		DATA.SQL = &quot;Select from Products&quot;
		DATA.Refresh
		GRID.Rebind
		End if
		END SUB
		&lt;/ SCRIPT &gt;
	&lt;/ BODY &gt;
&lt;/ HTML &gt;</pre>
    </font>
  </div>
  <p><font face="arial" color="#000000" size="2" style="line-height: 25px">每个<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;RDS.DataControl&nbsp;</b></font>物件可被连往不同的资料来源并可容纳各个查询的结果。当您使用<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;RDS.DataControl&nbsp;</b></font>物件向资料库发送请求时,RDS伺服器端元件传回给用户端一个<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;ADODB.Recordset&nbsp;</b></font>物件,接着RDS代理建立一个用户端和一个<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;ADOR.Recordset&nbsp;</b></font>物件以操纵传回的记录。您不需要为这一切写任何ADO程式码-当您使用RDS.DataControl物件时,RDS会帮您处理这一切。</font></p>
  <p><font face="arial" color="#000000" size="2" style="line-height: 25px">
  图3-3显示了基於Web的ADO应用程式的用户端和伺服器端元件是如何共同运作以处理使用者的请求并显示资料库的资讯。</font></p>
  <font face="arial" color="#000000" size="2" style="line-height: 25px">
  <ol style="line-height: 25px">
    <li style="line-height: 25px">使用者输入请求文字、选择一个预设的请求、或浏览到一个包含嵌入式请求的网页。 </li>
    <li style="line-height: 25px">当在一个网页上有事件发生时,例如<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;Window_OnLoad&nbsp;</b></font>程式或一个Search按钮的<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;OnClick&nbsp;</b></font>事件,ADO便在用户端建立一个<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;RDSServer.DataFactory&nbsp;</b></font>代理(或商务物件代理)。 
    </li>
    <li style="line-height: 25px">代理透过把商务物件方法的参数格式化成 
    URL参数,将使用者的请求转化为一个HTTP请求。然後,它将这一请求送往 Web伺服器指定的<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;RDS.DataControl 
    Server&nbsp;</b></font>属性。IIS 5.0继续将HTTP请求送往一个Internet Server Application 
    Programming Interface(ISAPI)延伸。 </li>
    <li style="line-height: 25px">Advanced Data ISAPI(ADISAPI)解释URL参数,建立一个被请求商务物件的例项,并进行方法呼叫(在预设情况下,它呼叫伺服器端<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;RDS.DataFactory&nbsp;</b></font>物件的Query方法)。 
    </li>
    <li style="line-height: 25px">
    <font face="arial" color="#3e80d7" size="2" style="line-height: 25px">
    <b style="line-height: 25px">&nbsp;RDS.DataFactory&nbsp;</b></font>物件透过OLE 
    DB执行使用者的查询。它设定<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;Recordset&nbsp;</b></font>的<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;CursorLocation&nbsp;</b></font>属性以使Cursor 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -