Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#3.0
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 | :confused:
Posted 29-Jul-10 21:15pm
Edited 30-Jul-10 3:21am
v3
Comments
Rajesh Sajjanar at 30-Jul-10 2:39am
   
Hi sarvanan pls reprase the question , as your question is not clear
saran_46 at 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 at 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 at 20-Aug-10 6:14am
   
Can u give any idea for this question.I can do it that way.
Thanks T.Saravanan.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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. Smile | :)
Prasad Vagal
  Permalink  
Comments
Sandeep Mewara at 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,
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Hi
 
Try using the SQLCommand.Cancel to stop executing the long running query
  Permalink  

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



Advertise | Privacy | Mobile
Web04 | 2.8.1411022.1 | Last Updated 14 Mar 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100