How do you extend the timeout length for a Report Viewer?
I have a Report Viewer on an ASPX Formthat uses an Object Data Source / Data Setthat connects to a SQL Server Database Stored Procedure. Depending on the parameters sent to the procedure, it will take longer than 30 seconds to run, thus generating the following error:An error occurred during local report processing.An error has occurred during report processing.Exception has been thrown by the target of an invocation.Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. How do I extend the timeout so that it does not timeout? Thanks!
July 7th, 2009 10:38pm
I am unaware of a connection time out property for the report viewer. Assure that:1. The dataset does not have a time out set a. From BIDS in the dataset proerties assure that timeout text box is empty2. From the report properties>Execution set the Report Execution Timeout Defaults to Do not time out report execution (the default property is Use the default setting)Hope this helpsDavid Dye
July 8th, 2009 12:55am
David,I probably should not have used the terminology "Report Viewer" in my question; that is just the Control giving me the error. (1) How do I assure the DataSet does not have a timeout set? I am using an XSD file. The only properties I have are CaseSensitive, EnforceConstraints, Locale, Modifier, Name, Namespace, Prefix and SchemaSerializationMode. (a) What isBIDS in theDataSetProperties? I do not see a timeout text box anywhere. (2) Also, I do not see an ExecutionProperty for the Report. I am using an RDLC file. There is nothing calledReportExecution Timeout Defaults either.We have tried editing the ConnectionString that the DataSet usesin the web.config file but that did not work. Original: <add name="example" connectionString="server=server\instance;user=sa;pwd=qwerty;database=dbName;" providerName="System.Data.SqlClient"/> New: <add name="example" connectionString="server=server\instance;user=sa;pwd=qwerty;database=dbName;" Connection Timeout=90" providerName="System.Data.SqlClient"/> Thanks for your help!Cardi
July 8th, 2009 3:54pm
Did you ever get an answer to this? I'm having the same problem.
July 30th, 2009 11:06pm
Unfortunately, no :(
August 4th, 2009 5:03pm
I figured out how to do this. I had to piece together help from a few different places, but it works.1. I added a typed dataset (dsCaseReport)to my project to hold the datatable (dtCaseRpt)and tableadapter (taCaseRpt)tied to my SQL stored procedure.2. I added a new class (clsCaseRpt)that I use to override the default timeout oftaCaseRpt since you can't do it via the designer. This code allows you to change the connectionstring timeout to 0 (which is unlimited) before you fill the dataset. Here is the code for that class. Imports Microsoft.VisualBasic Namespace dsCaseReportTableAdapters Partial Public Class taCaseRpt Public Property ConnectionString() As String Get Return Me.Connection.ConnectionString End Get Set(ByVal value As String) Me.Connection.ConnectionString = value End Set End Property Public Sub SetCommandTimeout(ByVal timeout As Integer) If Me.Adapter.InsertCommand IsNot Nothing Then Me.Adapter.InsertCommand.CommandTimeout = timeout End If If Me.Adapter.DeleteCommand IsNot Nothing Then Me.Adapter.DeleteCommand.CommandTimeout = timeout End If If Me.Adapter.UpdateCommand IsNot Nothing Then Me.Adapter.UpdateCommand.CommandTimeout = timeout End If For i As Integer = 0 To Me.CommandCollection.Length - 1 If Me.CommandCollection(i) IsNot Nothing Then Me.CommandCollection(i).CommandTimeout = timeout End If Next End Sub End Class End Namespace 3. Then instead of assigning the reportviewer (rvCase) to an Object Data Source on the page, I programmatically assign it to the dataset during the page load (or during any other sub). Here is the code for that. Note: I specify a Case ID parameter when filling my dataset. That is what the intCaseID variable is for. Also, notice that I call the SetCommandTimeout sub with the 0 parameter before filling the dataset. This overrides the default 30 second timeout. Finally, I assign the dataset as a new datasource to the reportviewer control. Dim taCaseRpt As New dsCaseReportTableAdapters.taCaseRpt Dim dsCaseReport As New dsCaseReport Dim intCaseID As Integer = 2 taCaseRpt.SetCommandTimeout(0) taCaseRpt.Fill(dsCaseReport.dtCaseRpt, intCaseID) rvCase.LocalReport.DataSources.Clear() rvCase.LocalReport.DataSources.Add(New ReportDataSource("dsCaseReport_dtCaseRpt", dsCaseReport.Tables(0))) Now it doesn't matter how long it takes for the stored procedure to run, my program will wait and the reportviewer will display once it is finished. I think I covered everything, but let me know if you have questions.
September 10th, 2009 4:35pm
Thanks a lot JJ_Berg! I will try that out next time I am working with Reporting Services.
September 14th, 2009 9:46pm
JJ_Berg,It looks like I am having one issue. I cannot access any of the function of "Me" in the code for Step 2 that I need. I created a Class, and then a Public Sub SetCommandTimeout(ByVal timeout As Integer) but for some reason when I use "Me" dot something, the only choices are Equals, Finalize, GetHashCode, GetType, MemberwiseClone, ReferenceEquals, SetCommandTimeout, ToString. It seems like the rest should fall into place. I think that is my only issue.Thanks for your help!!Cardi
October 20th, 2009 6:08pm
Hi Cardi,Can you paste the code from the Class you created and also the code you're using to assign the dataset to the reportviewer control? I have hard time troubleshooting without being able to look at the code.
October 20th, 2009 8:47pm
I need the same solution but in c#
March 7th, 2010 2:52pm
Here is a link to one of my favorite tools. It will convert VB to C# and vice versa. Just copy and paste the code into the box and click convert.http://www.developerfusion.com/tools/convert/vb-to-csharp/
March 8th, 2010 4:26am
Someone found a simple way to do that?
December 17th, 2010 8:13am
I've had a similar problem. Only, I used SqlDataSource insead of ObjDataSource. There is a stored procedure on the SQL Server, SqlDataSource and .rdlc report as LocalReport. The execution time of the stored procedure is about 2.5 - 3 minutes, so I constantly receive a message "timeout expired" from the ReportViewer. I almost become crazy :) All advice here - to no avail. After some bloody search, much swear and many probes I found the solution to this problem. It includes two steps: 1. You change the property CommandTimeout in the Selecting method of the SqlDataSource using the parameter structure e. Something like that: e.Command.CommandTimeout = 300 (for example) But doing only this isn't enough. The exception error "timeout expired" of the ReportViewer disappears but now you receive the same error from the web page renderer instead :) So the next step increases the timeout lapse for the page renderer. 2. Increase the timeout lapse for the page renderer with the help of the Ajax ScriptManager object. Simply set the AsyncPostBackTimeout property to the desired value in the visual designer. In my case this is 300. At last you prevail :)
March 1st, 2011 9:12am