What is the difference between SqlCommand.CommandTimeout and SqlConnection.ConnectionTimeout?

前端 未结 6 645
北荒
北荒 2020-11-27 15:32

Is there any difference between SqlCommand.CommandTimeout and SqlConnection.ConnectionTimeout in .NET?

6条回答
  •  情深已故
    2020-11-27 16:08

    ConnectionTimeout specifies the duration to wait before timing out when attempting to open an SqlConnection. It is relevant to the Connection.Open() command.

    while

    SqlCommand.CommandTimeout specified the duration for an SqlCommand to wait before timing out. This happens after a connection has been opened and one of the ExecuteXXX methods have been called on the Command object.

提交回复
热议问题