>I have a stored procedure that returns the data which I show on the grid. It generally takes less then 30 seconds. Now it will take 2 minutes or 3 minutes due to recent changes. The exception is thrown when it takes longer then 30 seconds. This is the message I get
>
>System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
>
Is this being run in an ASP.NET page? If so, the page itself is probably timing out. You can edit the web.config file and modify the executionTimeout and increase it (it's in seconds). It's in the
, section.
Or, you can set it on the page level by adding code to the Page_Init() and Page_Unload() to set/reset the timeout values:private int m_timeOut;
private void Page_Init(object sender, System.EventArgs e)
{
this.m_timeOut = Server.ScriptTimeout;
Server.ScriptTimeout = 60 * 3; // 3 minutes
}
private voide Page_Unload(object sender, System.EventArgs e)
{
Server.ScriptTimeout = this.m_timeOut;
}