sql server - How to recognize SqlException where user cancelled? -
so, cancelled query using sqlcommand.cancel. sql client returned sqlexception following message:
a severe error occurred on current command. results, if any, should discarded. operation cancelled user.
fine me. but, have gracefully deal since it's not regular error should reported. problem is, besides message there no indicator inside sqlexception object i've found identify caused user cancelling query.
i don't want use message itself. message changed @ 1 point or translated language @ point. error number property 0 , class property 11.
for sql server 2008 r2 , .net 4.0 following properties of sqlexception set
if property sqlconnection.fireinfomessageeventonusererrors set true
- class: 16
- number: 3204
- message: backup or restore aborted. restore database terminating abnormally. operation cancelled user.
if property sqlconnection.fireinfomessageeventonusererrors set false
- class: 11
- number: 0
- message: operation cancelled user.
Comments
Post a Comment