Is there any way to run SqlCommand.ExecuteScalar()
asynchronously and then cancel it (on the server side as well) whilst it's being executed?
Asked
Active
Viewed 869 times
0
1 Answers
4
.NET Framework 4.5 has a ExecuteScalarAsync() method.
See here: http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.executescalarasync(v=vs.110).aspx
ExecuteScalarAsync() also has an overload with a CancellationToken parameter that can be used to abandon the operation before the command timeout elapses.

Mark
- 1,455
- 3
- 28
- 51