ReportingAnalyst
MIS
I got this Progress Bar code when I did a google on this.
My question is how can I incorporate this progress bar with the time taken by the query to return the result set.
Thanks.
Code:
<% Response.Buffer = True %>
<html>
<style type="text/css">
<!--
#container {
width: 400px;
border: 1px solid #000099;
}
#progressBar {
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
color: #FFFFFF;
background-color: #0000FF;
width: 100%;
margin: 0px;
padding: 0px;
height: 30px;
font-size: 12px;
}
-->
</style>
<title>Progress Bar</title><body>
<div id="MyProgressBar">
Please wait while the page is loading...<br>
<span id="progressText">Progress: 0%</span><br>
<div id="container"><div id="progressBar"></div></div>
</div>
<%
Const DUMMY_NUMBER=100000
curPercent = 0
strDummy = ""
recPerPercent = CLng(DUMMY_NUMBER/100)
startTime = Now()
For x=1 To DUMMY_NUMBER
If (x Mod recPerPercent)=0 Then
Response.Write("<script type=""text/javascript"">")
Response.Write("document.getElementById(""progressText"").innerHTML = ""Progress: " &_
(curPercent+1) & "%"";")
Response.Write("document.getElementById(""progressBar"").style.width = """ &_
(curPercent+1) & "%"";")
curPercent = curPercent+1
Response.Write("</script>")
Response.Flush
End If
strDummy = strDummy&"x"
Next
Response.Write("<script type=""text/javascript"">")
Response.Write("document.getElementById(""MyProgressBar"").style.display = ""none"";")
Response.Write("</script>")
%>
</body>
</html>
My question is how can I incorporate this progress bar with the time taken by the query to return the result set.
Thanks.