I
I
isxaker2014-07-01 14:32:09
.NET
isxaker, 2014-07-01 14:32:09

How to cancel execution of SqlCommand?

Here is my method:
public static void Execute(SqlCommand command)
{
Thread rThread1 = new Thread(new ThreadStart(() => { command.ExecuteReader(); }));
Thread rThread2 = new Thread(new ThreadStart(() => { Thread_Cancel(command); }));
rThread1.Start();
rThread2.Start();
}
I get Exception:
Could not create constraint. See previous errors.
Operation canceled by user.

How to cancel execution of SqlCommand ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey, 2014-07-01
@Priest512

If I'm not mistaken, you want to cancel the thread before it starts. Maybe this is an exception. So it throws an exception. It's most likely a matter of flows. Read how to work with them. My opinion

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question