I have read now something about SQL Server timeout exceptions. I found these two links:
how to detect sql server timeout from .NET application without using catch Exception
How to catch SQLServer timeout exceptions
So -2 is a client timeout and when I'm understanding this right, one can use this for a server connection timeout and a command timeout. -1 and -3 are server network errors.
Now. Is it somehow possible in C# to catch an exception and distinguish between a server connection timeout and a command timeout?
Thank you very much!
EDIT: for example here:
https://msdn.microsoft.com/en-us/library/cc645611.aspx
-2 Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. (Microsoft SQL Server, Error: -2).
how to detect if a timeout period elapsed prior to a) completion of the operation or b) if the server is not responding? This is the problem.