共用方式為


SessionStateSection.SqlCommandTimeout 屬性

定義

使用 SQL Server 會話狀態模式取得或設定 SQL 指令的逾時時間。

public:
 property TimeSpan SqlCommandTimeout { TimeSpan get(); void set(TimeSpan value); };
[System.ComponentModel.TypeConverter(typeof(System.Configuration.TimeSpanSecondsOrInfiniteConverter))]
[System.Configuration.ConfigurationProperty("sqlCommandTimeout", DefaultValue="00:00:30")]
public TimeSpan SqlCommandTimeout { get; set; }
[<System.ComponentModel.TypeConverter(typeof(System.Configuration.TimeSpanSecondsOrInfiniteConverter))>]
[<System.Configuration.ConfigurationProperty("sqlCommandTimeout", DefaultValue="00:00:30")>]
member this.SqlCommandTimeout : TimeSpan with get, set
Public Property SqlCommandTimeout As TimeSpan

屬性值

也就是以秒計的時間,之後 SQL 指令就會超時。預設是 30 秒。

屬性

範例

以下程式碼範例示範如何取得該 SqlCommandTimeout 財產。 參考課程主題中的 SessionStateSection 程式碼範例,學習如何存取該 SessionStateSection 物件。

// Display the current SqlCommandTimeout property value.
Console.WriteLine("SqlCommandTimeout: {0}",
  sessionStateSection.SqlCommandTimeout);
' Display the current SqlCommandTimeout property value.
Console.WriteLine("SqlCommandTimeout: {0}", _
  sessionStateSection.SqlCommandTimeout)

適用於