.netsqlclientconnection-timeoutcommand-timeout

sqlclient - connection timeout or command timeout


I get the following error upon running a query.

*

System.Data.SqlClient.SqlException: Timeout expired.
The timeout period elapsed prior to completion of the operation or the server is not responding. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)

*

Is this a connection timeout or command timeout?

TIA


Solution

  • Looks like a command timeout. If you have a connection timeout, you will see from the stack trace that it's thrown from a call to SqlConnection.Open. Any other timeout will be a command timeout.