2012-04-05 65 views

回答

0

答案取自here

如果您使用的是強類型的TableAdapter你需要通過設置在_commandCollection的 指令(S)將CommandTimeout屬性編輯 生成的代碼:

YourDataSet.Designer.cs:

[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 
     [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] 
     private void InitCommandCollection() { 
      this._commandCollection = new global::System.Data.SqlClient.SqlCommand[1]; 
      this._commandCollection[0] = new global::System.Data.SqlClient.SqlCommand(); 
      this._commandCollection[0].Connection = this.Connection; 
      this._commandCollection[0].CommandText = "SELECT * FROM dbo.Table"; 
      this._commandCollection[0].CommandType = global::System.Data.CommandType.Text; 
      this._commandCollection[0].CommandTimeout = 1000; //Timeout in seconds 
     }