Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 23rd, 2008, 07:29 AM
Authorized User
 
Join Date: Feb 2007
Posts: 39
Thanks: 2
Thanked 2 Times in 2 Posts
Default Ajax in stored procedure execution

Hi Imar,
is it possible to use Ajax to show a progress bar in my .aspx page when I run a stored procedure?

Thanks in advance.

Luigi

 
Old May 23rd, 2008, 08:59 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

The difficult part of this idea is that while Ajax is asynchronous and happening in the background, it's still working against the standard HTTP protocol. You send a request to the server and wait an unknown time until the response comes back.

In order to build something that provides progress you'd have to do several things:
- Spin off a thread to do your background work so the initial call is not blocked.
- Maintain knowledge of that thread (i.e. persist a thread ID in user session or similar)
- Provide some mechanism on an object in that thread context for accessing progress (possibly difficult with a SQL call, depending on what you are doing in SQL it might be easier or harder)
- Change your client code behavior from a single AJAX call to run the process, to a call that starts the process, then sets up a timer for status polling.

-Peter
compiledthoughts.com
 
Old May 23rd, 2008, 09:12 AM
Authorized User
 
Join Date: Feb 2007
Posts: 39
Thanks: 2
Thanked 2 Times in 2 Posts
Default

Thank you Planoie, so it's not so easy that I thought.

L

 
Old May 23rd, 2008, 09:55 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

If you don't really need a progress bar to indicate progress, but only need a "please wait" message (like a Spinner image), you can also use an UpdatePanel in combination with an UpdateProgress control.

Not perfect, but it may do the trick.

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.





Similar Threads
Thread Thread Starter Forum Replies Last Post
stored procedure keyvanjan Classic ASP Basics 2 May 26th, 2006 01:16 AM
Stored Procedure rajanikrishna SQL Server 2000 0 July 18th, 2005 05:01 AM
stored procedure allang MySQL 3 January 26th, 2005 12:48 PM
Stored Procedure desireemm SQL Language 5 September 18th, 2004 02:34 AM
Stored Procedure... babloo81 SQL Server 2000 2 May 1st, 2004 11:25 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.