Asynchronous execution is the retrieval of data in the background, which can be used on a Web page before all data is returned. Although all data may be required, asynchronous work can begin processing data at least in advance. It also allows users to see something first, which makes the Web site appear to be more responsive.
Like TDC, an RDS data control can set its properties by setting parameters for object tags or by writing code. Here's an example:
<object classid= "Clsid:bd96c556-65a3-11d0-983a-00c04fc29e33"
Id= "dsoauthors" width= "0" height= "0" >
<param name= "Connect" value= "Dsn=pubs" >
<param name= "Server" value= "W2000" >
<param name= "SQL" value= "select * from Authors" >
</OBJECT>
is equivalent to:
<object classid= "Clsid:bd96c556-65a3-11d0-983a-00c04fc29e33"
Id= "dsoauthors" width= "0" height= "0" >
</OBJECT>
<script language=jscript>
function Window.onload ()
{
Dsoauthors.connect = "Dsn=pubs";
Dsoauthors.server = "W2000";
Dsoauthors.sql = "SELECT * from Authors";
Dsoauthors.refresh ();
}
</SCRIPT>
A DSN is used here for the connect parameter because it works well for the page, but it can also be any valid ADO connection string.
The URL is a new feature provided by ADO version 2.5 that allows a file to be used as a data source. The file can be in two formats: one is a Recordset saved with the Recordset.save method, and the other is an ASP page that creates a recordset and then saves it in a stream. The code is as follows:
<object classid= "Clsid:bd96c556-65a3-11d0-983a-00c04fc29e33"
Id= "dsoauthors" width= "0" height= "0" >
<param name= "URL" value= "datapage.asp" >
</OBJECT>
The file datapage.asp contains the following VBScript code:
<%
Dim Rsdata
Set rsdata = Server.CreateObject ("ADODB. Recordset ")
Rsdata.open "SELECT * from Authors", strconn
Rsdata.save Response, adPersistXML
Rsdata.close
Set Rsdata = Nothing
%>
This simply creates a recordset and then saves the recordset in XML format to the response object with the Save method. In earlier versions of ADO, only the recordset could be saved as a physical file, and the ADO 2.5 version could directly save it as a stream. The result of this ASP page is the recordset in XML format. The next chapter will look at all the topics about streaming and XML data.
The best advantage of using the URL property over the Connect and SQL properties is that the details of the connection will not appear in the Web page that the user can see. Consider the following object definition:
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service