Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Timeout Error for sql data source

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>
like image 477
Cloud Avatar asked Jun 29 '12 16:06

Cloud


People also ask

What is timeout in database connection?

The time (in seconds) to wait for a connection to open. The default value is 15 seconds.

Why does SQL timeout?

SQL Server will typically show you connection timeouts or operation (query) timeouts. These values are set by the client connecting to the SQL Server. An operation timeout occurs when a command takes too long to complete, and the client raises an error.

How do I change the command timeout in SQL?

Changing Command Timeout in Server: In the object browser tree right click on the server which give you timeout and select "Properties" from context menu. you can set the value in up/down control. Save this answer.


1 Answers

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

like image 197
Fraz Sundal Avatar answered Nov 05 '22 03:11

Fraz Sundal