Timeout Error for sql data source

不打扰是莪最后的温柔 提交于 2019-12-10 04:06:48

问题


Error code:

Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

Can someone provide me with code I can copy and paste so I can change the default timeout? I'm not sure where to put it into this code:

<head runat="server">
<title>Proxy Report</title>
</head>
<body>
<form id="form1" runat="server">
<div>

    <asp:Label ID="Label1" runat="server" Text="Proxy Report"></asp:Label>

</div>
<asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1">
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
    ConnectionString="<%$ ConnectionStrings:ISALog1ConnectionString %>" 
    SelectCommand="ProxyReport" SelectCommandType="StoredProcedure">

</asp:SqlDataSource>
</form>
</body>
</html>

回答1:


You can increase the Timeout property like this

protected void SqlDataSource1_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
        {
            e.Command.CommandTimeout = 0;
        }

Setting timeout to 0 means no timeout



来源:https://stackoverflow.com/questions/11265593/timeout-error-for-sql-data-source

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!