I have to execute a stored procedure. When I execute that, I have to keep on check (ping) whether that execution is completed or not. The I will update a label.
Do we have any way in c# to do that?
I have to execute a stored procedure. When I execute that, I have to keep on check (ping) whether that execution is completed or not. The I will update a label.
Do we have any way in c# to do that?
Call the stored procedure asynchronously, and have the callback update your label.
SqlCommand.ExecuteNonQuery()
returns an int when it is complete. If you're doing this "in line" then ExecuteNonQuery()
won't hand control to the next statement until the stored procedure is complete.
If you're doing this in a background thread somehow (threading / asynchronous call) the code within your background thread will still not hand control to the next statement until the proc ends (okay, not exactly, Asynchronous uses IAsynchCallback- I'm trying to be general here) so the AsynchCallBack or the Thread.Exit() should be able to tell your main thread that the procedure is complete.