Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can a user cancel a long running query?
    primarykey
    data
    text
    <p>Related: <a href="https://stackoverflow.com/questions/1092433/how-can-you-cancel-a-sql-server-execution-process-programmatically">How can you cancel a SQL Server execution process programmatically</a> </p> <p>I have created an application (Windows, WPF) which is basically a viewer for data in a database (Sql Server). The application has NO editing functionality. </p> <p>The application provides the ability to search for records based upon input from the user. For the most part, the rows are searched by a key column and run pretty fast. But one column in the table is a large text field and I want to provide the ability to search for rows based on the content of this field. Because of this, the resulting sql query could take some time to complete. I want to provide a Stop button so that the user can abort the search, if desired. The link I placed above uses the Kill command to kill a spid in Sql server, but I'm not sure how this would work in my situation since I am using the Entity Framework (4.1)</p> <p>For example, suppose a have a query similar to this:</p> <pre><code>var docs = from document in context.Documents join header in context.Headers on document.DocumentID equals header.HeaderID into headerGroup from subdoc in headerGroup.DefaultIfEmpty() where document.LargeTextColumn.Contains("search term") select (...) foreach (var item in docs) { //Do something with item here } </code></pre> <p>Since the query doesn't actually happen until I iterate through it with the foreach statement, how can I provide the user with a "Stop Query" button? This is similar to the stop button in Sql Server Management Studio.</p> <p>Is this possible?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload