Is there any difference between SqlCommand.CommandTimeout
and SqlConnection.ConnectionTimeout
in .NET?
.net – the difference between SqlCommand.CommandTimeout and SqlConnection.ConnectionTimeout
.netsqlcommandsqlconnection
Related Question
- .net – What’s the difference between struct and class in .NET
- C# – the difference between const and readonly in C#
- C# – What are the correct version numbers for C#
- .net – the best algorithm for overriding GetHashCode
- C# – How to get a consistent byte representation of strings in C# without manually specifying an encoding
- C# – In C#, what is the difference between public, private, protected, and having no access modifier
- .net – Difference between decimal, float and double in .NET
- .net – the difference between .NET Core and .NET Standard Class Library project types
Best Solution
Yes.
CommandTimeout
is how long a single command can take to complete.ConnectionTimeout
is how long it can take to establish a connection to the server to start with.For instance, you may be executing relatively long-running queries - it's perfectly okay for them to take 10 minutes to complete, but if it took 10 minutes to make the connection to start with, you'd know that something was badly wrong.