Click here to Skip to main content
15,885,896 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi,
I design a query analyzer in windows application using C#.User can design a query from a given fields and then click a button, the query goes to sql server after execution result show in datagridview.But my question is if user click a button that query execution take a long time at the same time,how to stop that execution process using another button event.

Example: Button1--> Submit
Button2--> Stop

Submit--> For Query Execution Process.
Stop --> Stop that Execution Process.


Advance Thanks,
T.Saravanan :confused:
Posted
Updated 30-Jul-10 2:21am
v3
Comments
Rajesh Sajjanar 30-Jul-10 2:39am    
Hi sarvanan pls reprase the question , as your question is not clear
T.Saravanann 30-Jul-10 4:45am    
Actually i design a query analyzer in windows application.User can design a query to select a different fields from different tables.That query goes to execute in sql server after execution that result displayed in datagridview. If that query execution takes more time how to stop that execution from front end(using C# code)at the same time it comes to previous stage.

Thanks,
Prasad Bansi Vagal 2-Aug-10 13:03pm    
Reason for my vote of 5
nice question, but i can't give you any code for it or else you will only copy, paste it, not learn something and do, do it arrange code, practise on .net, etc.
T.Saravanann 20-Aug-10 6:14am    
Can u give any idea for this question.I can do it that way.
Thanks T.Saravanan.

Use indexes to execute your sql query in C# or any language code, say filter query as posible, as it will fetch as much data it need, it will be easy to make execution stop, it will make it faster, in short use filters in your code to make it simple and to make work your sql execution faster. :)
Prasad Vagal
 
Share this answer
 
Comments
Sandeep Mewara 30-Jul-10 5:18am    
Comment by OP: Prasad can u send the code.
But my problem is explain here.

Actually i design a query analyzer in windows application.User can design a query to select a different fields from different tables.That query goes to execute in sql server after execution that result displayed in datagridview. If that query execution takes more time how to stop that execution from front end(using C# code)at the same time it comes to previous stage(User needs).
Thanks,
Hi
Try using the SQLCommand.Cancel to stop executing the long running query
 
Share this answer
 

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