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

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

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

6条回答
  •  盖世英雄少女心
    2020-11-27 16:10

    Additional Info

    Default value of CommandTimeout is 30 seconds. Zero(0) indicates no limit. You can set CommandTimeout value in Coding only.

    Default value of ConnectiontTimeout is 15 seconds. Zero(0) indicates no limit as well. Less than zero value (minus value) will get ArgumentException. You can set ConnectionTimeout value in both Coding and Config file.

提交回复
热议问题