Browsed by
Month: February 2012

Not having to delete the data file every time you run a report

Not having to delete the data file every time you run a report

In SQL Server Reporting Services, every time you preview a report, a file of type .data is stored in your project folder that caches the data when the report is run. When you have your data sets all set up and you’re only working on the layout of the report, this is a very good functionality because every time you preview your report, SSRS doesn’t have to pull the data from the source every time.

However, when your data sets change as well, you can get a very nasty error message:

Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index

Or maybe the data in your report does not change according to the changes that you made in your dataset. In that last case, you have to delete the .data file in your BIDS project folder and preview the report again.

If you want to make your report development life easier but then again, if you are ok with pulling the data from the source every time you preview your report, open your SSRS config file located in this location for SQL Server 2008:

C:Program Files (x86)Microsoft Visual Studio 9.0Common7IDEPrivateAssembliesRSReportDesigner.config

In this file, near the beginning of the code, you have to set the option “CacheDataForPreview” on True when you want to keep the .data files and on False when you don’t want to use these files: