出错信息:超时时间已到。在操作完成之前超时时间已过或服务器未响应。
堆栈跟踪: 在 System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount) 在 System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount) 在 System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping) 在 System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable dataTable, DataTableMapping tableMapping) 在 System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String srcTable) 在 member.info_add.Button1_Click(Object sender, EventArgs e) 在 System.Web.UI.WebControls.Button.OnClick(EventArgs e) 在 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) 在 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) 在 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) 在 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) 在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) web.config配置文件如下
<add key="MSSQLConnectionString" value="uid=huisunv2;pwd=Huisunv2_050524;initial catalog=HuisuncomcnNet;data source=.;Connect Timeout=900;connection lifetime=5;min pool size=1;max pool size=500" />
请问要怎么改才不会超时

解决方案 »

  1.   

    command对象属性:
    SqlCommand cmd = new SqlCommand();
    cmd.CommandTimeout = 180;
    再运行,即解决,这里设置的时间的180秒,即三分钟!可根据需要设置,如果过长,也可以设置为0,当此属性设置为0时表示不限制时间。此属性值应该慎用。还需要在Web.config配置文件中设置http请求运行时限间
    <system.web>  
    <httpRuntime maxRequestLength="102400" executionTimeout="720" />
    </system.web>
      

  2.   

    把sqlCommand对象的CommandTimeout 时间设长点
      

  3.   

    using释放资源,关闭相关链接
    在查询分析器执行语句看效率
      

  4.   

    <system.web>
      <sessionState     
      mode='InProc'   
      stateConnectionString='tcpip=127.0.0.1:42424'   
      sqlConnectionString='data source=127.0.0.1;Trusted_Connection=yes'   
      cookieless='false'     
      timeout='140000'     
      />  
    </system.web>
    这边已经设置成这样了
      

  5.   

    这是connection的超时设置
    command的超时默认是30,如果你语句复杂,也需要设置一下