July 2000
Intermediate to advanced
492 pages
14h 53m
English
Flush —
Response.Flush
Immediately sends all data currently in
the response buffer to the client. Unless the Buffer property of the
Response object is set to True, this method will
result in a runtime error. This method allows you to send various
portions of the response to the client at your discretion.
None
<% Response.Buffer = True%>
<HTML>
<HEAD><TITLE>Response Flush Method Example</TITLE></HEAD>
<BODY>
<%
' Suppose for this example that this first part of the
' script retrieves some information from a database and
' that retrieval takes a long time, say 30 seconds.
' (Don't worry about the details of the ActiveX Data Object
' calls. They are covered later in the book and serve only
' as an example here of something that might take a long time.)
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open MyDatabase
Set adoRec = adoCon.Execute([BIG SQL STATEMENT])
' Rather than continue to the second part of the script, in
' which a second slow SQL statement (say another 15 seconds)
' executes, first we'll use the Flush method to force the
' first part of the script results to the client. This way,
' the user can be looking at the results of the first query
' while waiting for the second.
Response.Flush
' [Second LONG SQL statement.]
Set adoRec2 = adoCon.Execute([BIG SQL STATEMENT])
%>
</BODY></HTML>Using the buffering capacity of the Response object, you are able to send the response to the client in parts. For example, suppose you are ...
Read now
Unlock full access