Click here to Skip to main content
15,918,211 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I want to kill or stop the thread which is running in for loop.
In for loop I'm inserting records into the database. Once I click on Abort it should stop the operation.

Thanks
sjs
Posted
Updated 19-Aug-10 23:24pm
v2

This question is either mis tagged, or idiotic. An ASP.NET website should not use threading, because your sub thread will be orphaned when your page lifecycle ends.
 
Share this answer
 
Hi sjs4u,

Just you call Abort method.

System.Threading.Thread thread;

//One Event
thread=new Thread(new ThreadStrart(Function Call));
thread.Start();

//Another Event (Its your stop Operation)
thread.Abort();

I think its helpful to you.

Thanks :)
 
Share this answer
 
Comments
sjs4u 20-Aug-10 5:40am    
Thanks for your reply.

On Start import file Button Click event I have written code :-
myThread = new Thread(new ThreadStart(delegate() { myfun(FileNameList); }));
myThread.Start();


Now my myfun() contains DB operation like I m inserting the records using for loop

Now I want to stop that thread on the second button that is abort button

So How can I write the code to kill or stop or abort the database iteration.

thanks
sjs

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900