Stored Proc form VB

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi
Can someone tell me if and how it's possible to let a user exit an execution of a Stored Procedure. As it is right now, the user makes some selections in a form, then clicks the search button. Now a stored procedure is executed, in a separate thread. This execution time can sometimes last for more than 1 minute (sometimes even more) since there are nearly 2.000.000 records in DB (SQL Srvr) and the in parameters to SProc can vary a lot. Is it possible to take some action, when user clicks CANCEL button in popup progress form, to exit the execution. I'm not sure if it's possible, but if I should try to "kill" the thread in which the SProc is running

/Rickard
 
Hi Rickard,

When it is in a seperate thread and you have focus on your UI you can look
for the thread.abort, that works for me in some situations like this.

There is no thread kill, but the abort has almost the same behaviour.

Cor
 
Herfried,

I think this has nothing to do with ADO.NET but with threads, so please not
so quick, just give it some time for others to answer.

Cor
 
* "Cor said:
I think this has nothing to do with ADO.NET but with threads, so please not
so quick, just give it some time for others to answer.

Nope, IMO with ADO.NET. ADO.NET programmers will have more experience
with the problem, that's why I gave the hint.
 
Nope, IMO with ADO.NET. ADO.NET programmers will have more experience
with the problem, that's why I gave the hint.

This was the question
I'm not sure if it's possible, but if I should try to "kill" the thread in
which the >SProc is running ?


When you don't know what a thread is, don't give an answer to an OP.
It does not have much to do with Ado.net, that is more for OleDb and SQL
server.

If you have questions about that, feel free to ask.

:-)))))

Cor
 
Hi and thank you

Using the phrase "kill a thread" was only a way of saying "remove thread" and i have tried to abort the thread but this doesn't seem to work since the result is returning from SProc anyhow. But if you can, tell me exactly how to use abort with a background thread. Do I have to use some kind of other method on thread to remove it and the "processes" tied to it

/Rickard
 
Hi Rickard,

I just do it like this

FirstThread = New System.Threading.Thread(AddressOf FirstThreadStart)
FirstThread.Start()

Public Sub FirstThreadEnd()
FirstThread.Abort()
End Sub

Keep in mind that the thread is not direct deleted from memory.

Cor
Using the phrase "kill a thread" was only a way of saying "remove thread"
and i have tried to abort the thread but this doesn't seem to work since the
result is returning from SProc anyhow. But if you can, tell me exactly how
to use abort with a background thread. Do I have to use some kind of other
method on thread to remove it and the "processes" tied to it?
 
* "Cor said:
I just do it like this

FirstThread = New System.Threading.Thread(AddressOf FirstThreadStart)
FirstThread.Start()

Public Sub FirstThreadEnd()
FirstThread.Abort()
End Sub

Keep in mind that the thread is not direct deleted from memory.

Mhm... Will this terminate the execution of the stored procedure? I
_would_ ask the question in the ADO.NET group.

;-)
 
Hi Herfried,
Mhm... Will this terminate the execution of the stored procedure? I
_would_ ask the question in the ADO.NET group.

I know, but I saw you never ask a question there, while I watch that group
also.

:-)

What do you think what happens if the user plugs of the power while
processing, that is for the stored procedure in my eyes the same as aborting
a thread.

Cor
 
Back
Top