解法:SqlCommand.CommandTimeout[msdn] 加大,預設為30(秒)。

錯誤:SQL執行的時間太長就會發生 System.Data.SqlClient.SqlException。

ex
{"已超過連接逾時的設定。在作業完成之前超過逾時等待的時間,或者是伺服器未回應。" }
    [System.Data.SqlClient.SqlException]: {System.Data.SqlClient.SqlException}
    System.Object: {System.Data.SqlClient.SqlException}
    _className: null
    _COMPlusExceptionCode: -532459699
    _exceptionMethod: <未定義的值>
    _exceptionMethodString: null
    _helpURL: null
    _HResult: -2146232060
    _innerException: { }
    _message: "系統錯誤。"
    _remoteStackIndex: 0
    _remoteStackTraceString: null
    _source: null
    _stackTrace: {System.Array}
    _stackTraceString: null
    _xcode: -532459699
    _xptrs: 0
    HelpLink: null
    HResult: -2146232060
    InnerException: { }
    Message: "已超過連接逾時的設定。在作業完成之前超過逾時等待的時間,或者是伺服器未回應。"
    Source: ".Net SqlClient Data Provider"
    StackTrace: "   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream)\r\n   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)\r\n   at System.Data.SqlClient.SqlCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)\r\n   at System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)\r\n   at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)\r\n   at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)\r\n   at Textar.Klchang.Helper.SqlClient.DbBroker.QueryDS(String cmdText, CommandType cmdType, IDataParameter[] parameters) in d:\\project\\mmde\\core\\sqlclient3\\dbbroker.cs:line 436\r\n   at mmde.core.db.clsRptZ.RptZ02(DateTime COURSE_DATE1, DateTime COURSE_DATE2, DateTime VIEW_DATE1, Date
Time VIEW_DATE2) in d:\\project\\mmde\\web\\core\\db\\clsrptz.cs:line 56\r\n   at mmde.admin.reports.RptZ02.BindData() in d:\\project\\mmde\\web\\admin\\reports\\rptz02.aspx.cs:line 50"
    TargetSite: {System.Reflection.RuntimeMethodInfo}

其它:調整 SqlConnection.ConnectionString[msdn] (Connect Timeout, Connection Timeout)參數無效!