Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update textbox while going thru recordset

Status
Not open for further replies.
Apr 27, 1999
705
US

Hi,


I have a recordset of about 1000 entries that needs to be processed. On the web page, I would like to display the progress of going through the recordset, possibly updating a textbox with the information.

Anybody have any ideas?

fengshui1998
 
Not easy to do with ASP. If you were using Java Servlets/JSP...

Anyways, you could use a Mutipart Response HTTP Connection (also known as a Server Push) but they are not fully supported by all browsers.

You could do your inserts in batchs and set the page to refresh every X seconds. Each time the page is request perform another batch and update the counter on the page. This is probably the best solution but it is not without its problems (mainly inefficiency).

Other than that the only thing you could do would be use a Java Applet.

If anybody else has other ideas let me know. Wushutwist
 
wushutwist

Do you have any sample code that I could peruse through.
Much appreciated and thanks for your response.


Cheers,
fengshui1998
 
Updating information to the screen about the progress of your execution isn't terribly tricky in and of itself. The tricky part is making it look good.

Problem is that since the server side code is being executed before any of the client side "prettiness" is... and so the displayed information is just going to be on a blank white page.....

You might consider this, however. The page that is doing the processing... try to make it just do the processing. By that I mean, you have a page that looks very nice, etc... By pressing a button, the user opens up a popup window (the processing window) and since you can control the size, features, etc... of that window, a plain white page displaying numbers, or whatever might not look so bad -- so that's where you do your work, rather than the parent page.

So response.write() a little header on that page followed by a line break, and then for every iteration of the loop in execution, maybe you would write a period (.) and a space ( &nb sp; ) or something so that your user would be cued that the page is not just dead in the water, but that there is something going on.

Then, after the execution stops, the rest of the client side code could be executed, and so you might put this right before your </body> tag of the popup:

<script language=javascript>window.close();</script>

So that when the processing is finished, the &quot;progress window&quot; closes, and your user is once again presented with the nice page that he/she started on.

Hope that helps! :)
Paul Prewett
penny.gif
penny.gif
 


link9,

I read your response and opening the window is not a problem. Thew problem is that the server is doing the processing, but I want to show the progress on the client.

If you know where some code is available that can do this, I would appreciate it very much.


fengshui1998
 
Ok, say our operation is simply to update a table -- for simplicity's sake, we'll say this update is the same update over and over and over -- 1000 times.... now obviously, I'm just supposing, but here's an example of how you might do that with this example:


<%language=vbscript%>
<%option explicit%>
<%
dim con, sql
sql = &quot;UPDATE tableName SET column = value&quot;
set con = server.createObject(&quot;ADODB.Connection&quot;)
con.open (&quot;DSN=myDSN;UID=uid;PWD=pwd&quot;)

response.write(&quot;<h3 align=center>Updating... please wait</h3>&quot;)

dim i
for i = 1 to 1000
con.execute sql
response.write(&quot;. &quot;)
if i mod 10 = 0 then
response.write(&quot;<br>&quot;)
end if
next
%>
<html>
<head><title>Updating...</title></head>
<body>
<script language=javascript>window.close();</script>
</body>
</html>

Which will simply open the window, run the updates, showing ten periods on each line and then a line break -- and then close the window when processing is finished.

:)
paul
penny.gif
penny.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top