473,320 Members | 1,870 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Fake progress bar whilst Stored Procedure runs using ASP

I have a stored procedure that needs to be executed via an ASP page.

The SP does a number of tasks, mainly comparing a local table against a
linked server table, and updating/inserting/deleting where necessary. It
does this on 4 tables, one of them being fairly large, which will keep
on growing.

I have constructed the ASP page, made an animated GIF for the fake
progress bar, and then inserted the command to run the SP.

I then check the return value and if its 0 the page is redirected to a
results page which shows a table.

When I run this page I don't get to see the animated gif, the page
pauses until the SP is complete and redirects direct to the results page.

How can I make the page load the animated gif first, and then once the
SP has run and is successful redirect?

<img src="progress.gif" width="150" height="150" />
<p>Please wait, upload in progress...</p>
<%

set cmUpload = Server.CreateObject("ADODB.Command")
cmUpload.ActiveConnection = MM_aclv4_STRING
cmUpload.CommandText = "dbo.updateWebshop"
cmUpload.Parameters.Append cmUpload.CreateParameter("@RETURN_VALUE", 3, 4,2)
cmUpload.CommandType = 4
cmUpload.CommandTimeout = 0
cmUpload.Prepared = true
cmUpload.Execute()

%>
<% If cmUpload.Parameters("@RETURN_VALUE") = 0 Then
Response.Redirect("results.asp")
Else%>
<p>Error Code: <%= cmUpload.Parameters("@RETURN_VALUE") %></p><% End if %>
Jul 15 '08 #1
4 4335
Dooza wrote on Tue, 15 Jul 2008 14:52:42 +0100:
I have a stored procedure that needs to be executed via an ASP page.
The SP does a number of tasks, mainly comparing a local table against a
linked server table, and updating/inserting/deleting where necessary.
It does this on 4 tables, one of them being fairly large, which will
keep on growing.
I have constructed the ASP page, made an animated GIF for the fake
progress bar, and then inserted the command to run the SP.
I then check the return value and if its 0 the page is redirected to a
results page which shows a table.
When I run this page I don't get to see the animated gif, the page pauses
until the SP is complete and redirects direct to the results
page.
How can I make the page load the animated gif first, and then once the SP
has run and is successful redirect?
<img src="progress.gif" width="150" height="150" />
<p>Please wait, upload in progress...</p>
<%
set cmUpload = Server.CreateObject("ADODB.Command")
cmUpload.ActiveConnection = MM_aclv4_STRING cmUpload.CommandText =
"dbo.updateWebshop"
cmUpload.Parameters.Append cmUpload.CreateParameter("@RETURN_VALUE", 3,
4,2)
cmUpload.CommandType = 4 cmUpload.CommandTimeout = 0 cmUpload.Prepared
= true cmUpload.Execute()
%>
<% If cmUpload.Parameters("@RETURN_VALUE") = 0 Then
Response.Redirect("results.asp")
Else%>
<p>Error Code: <%= cmUpload.Parameters("@RETURN_VALUE") %></p><% End if
%>


Have you got Buffering turned on? If so, put a Response.Flush after the img
tag, but before the command Execute call. So long as you're not inside a
table then the browser should render what has been sent up to that point.

--
Dan
Jul 15 '08 #2
Daniel Crichton wrote:
Have you got Buffering turned on? If so, put a Response.Flush after the img
tag, but before the command Execute call. So long as you're not inside a
table then the browser should render what has been sent up to that point.
Hi Daniel.
Buffering is on by default in IIS6, so I tried what you said, and it
almost worked... the Response.Redirect at the end of the update has
caused this error:

Response object error 'ASP 0156 : 80004005'

Header Error

/webshop/upload.asp, line 26

The HTTP headers are already written to the client browser. Any HTTP
header modifications must be made before writing page content.

Any idea how I can get pass this hurdle?

Cheers,

Steve
Jul 15 '08 #3
Dooza wrote:
Response object error 'ASP 0156 : 80004005'

Header Error

/webshop/upload.asp, line 26

The HTTP headers are already written to the client browser. Any HTTP
header modifications must be made before writing page content.

Any idea how I can get pass this hurdle?
I ended up using some javascript instead:

<img src="progress.gif" width="150" height="150" />
<p>Please wait, update in progress...</p>
<% Response.Flush() %>
<%

set cmUpload = Server.CreateObject("ADODB.Command")
cmUpload.ActiveConnection = MM_aclv4_STRING
cmUpload.CommandText = "dbo.updateWebshop"
cmUpload.Parameters.Append cmUpload.CreateParameter("@RETURN_VALUE", 3, 4,2)
cmUpload.CommandType = 4
cmUpload.CommandTimeout = 0
cmUpload.Prepared = true
cmUpload.Execute()

%>
<% If cmUpload.Parameters("@RETURN_VALUE") = 0 Then
Response.Write("<script language=javascript>window.location =
""results.asp"";</script>")
%>
<% Else %>
<p>Error Code: <%= cmUpload.Parameters("@RETURN_VALUE") %></p>
<% End if %>
Jul 15 '08 #4
Dooza wrote on Tue, 15 Jul 2008 16:52:44 +0100:
Dooza wrote:
>Response object error 'ASP 0156 : 80004005'
>Header Error
>/webshop/upload.asp, line 26
>The HTTP headers are already written to the client browser. Any HTTP
header modifications must be made before writing page content.
>Any idea how I can get pass this hurdle?
I ended up using some javascript instead:
<img src="progress.gif" width="150" height="150" / <p>Please wait,
update in progress...</p>
Ah, I missed the Response.Redirect further down in your code. Using client
scripting is pretty much the only workaround for this.

--
Dan
Jul 16 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: C Kirby | last post by:
In SQL Server 2000, I've got a rather lengthy stored procedure, which creates a lot of temporary tables as it processes down through a few sets of data. When testing it through Query Analyzer, it...
0
by: Nashat Wanly | last post by:
HOW TO: Call a Parameterized Stored Procedure by Using ADO.NET and Visual C# .NET View products that this article applies to. This article was previously published under Q310070 For a Microsoft...
9
by: Ralph Cramden | last post by:
I'm writing a VB6 app which calls several stored procedures on my SQL Server DB. The first stored procedure must complete its inserts before the second stored procedure can query the modified...
2
by: blarfoc | last post by:
Hello, I have a web application that runs a sql server stored procedure. There are 10 stored procedures to chose from and the web user can pick any one of them. They have 10 buttons. Each stored...
6
by: SandySears | last post by:
I am trying to use a stored procedure to insert a record using VS 2005, VB and SQL Server Express. The code runs without errors or exceptions, and returns the new identifer in the output...
11
by: processoriented | last post by:
Hi, I'm something of a noob at this, but here it is... I have an app that fills a dataset from a SQL database, and then writes the dataset to an xml file. Everything is a SELECT query... I am...
3
by: Tim Satterwhite | last post by:
Hi All, I think this is a thorny problem, and I'm hoping you can help. I've not found this exact issue described anywhere yet. I have a stored procedure that calls BULK INSERT on a set of...
2
by: acw | last post by:
On a SQL Server 2000 db I would like to setup a stored procedure that accesses couple tables and runs the extended stored procedure xp..cmdshell. The goal is to grant users with limited privileges...
11
by: peter | last post by:
I am trying to get a SQL stored procedure to use user maintained MQT implicitly which raises questions on when they are used or not used. In theory you would expect the stored procedure to pick up...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.