Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Updating a progress bar in .net app, while executing a stored procedure

Posted on 2012-04-12
7
Medium Priority
?
854 Views
Last Modified: 2012-04-12
Hello,
I have a small application written in vb.net. It has a function that calls a stored procedure(SQL Server) using sql command object. Now the functionality of the stored procedure is to perform a mass update of a table on various rows. Lets say almost 5000 rows based on certain condition for each of the row. For this I use a cursor.  

Query:
How can I put a progress bar in my .net application and update the user when each of the rows gets updated by the stored procedure? Currently I dont get a response from the sp until its over. Any idea?

Thanks.
0
Comment
Question by:DoubtMan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 14

Expert Comment

by:binaryevo
ID: 37837951
0
 
LVL 17

Expert Comment

by:Barry Cunney
ID: 37837977
If you wanted to get more complex but have more control and possibly a more professional approach would be to use threads.

You would instantiate a secondary worker thread that would handle and monitor the stored procedure as it works. You would then code this worker thread to send messages back to the interface thread which would update the progress bar on the interface - This approach should leave the interface 100% responsive
0
 

Author Comment

by:DoubtMan
ID: 37838027
Hi Bcunney,
reading your solution seems to be promising. However, will it be possible for you to give an example how to do that? I mean with some code?

Thanks very much.
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
LVL 14

Expert Comment

by:binaryevo
ID: 37838089
Threading is a better solution, i agree, but, as bcunney said, a little more complex.  It all depends on how in depth you want to get.
0
 
LVL 17

Accepted Solution

by:
Barry Cunney earned 2000 total points
ID: 37838402
Yes if you have time threading would definitely be worth exploring
http://www.vbforums.com/showthread.php?t=651352
0
 
LVL 17

Expert Comment

by:Barry Cunney
ID: 37838419
I actually had done exactly what you are trying to do 10 years ago in C++ -
I had a worker thread that executed a SQL Server 2000 stored procedure(the stored proc ran a SQL Profiler trace)
This worker thread was coded to send windows messages back to the main thread and as the main thread received these messages it updated the interface accordingly(by displaying messages to the user in the status bar panel on the form - like 'Trace running', 'Trace completed' etc )
0
 
LVL 14

Expert Comment

by:binaryevo
ID: 37838689
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question