Solved

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

Posted on 2012-04-12
7
827 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 500 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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

726 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