Share via


Report name with spaces and the ReportEmbeddedResource property of the Whidbey Report Viewer control

Ran into an interesting (and I guess understandable) behavior today while playing with the Visual Studio 2005 Report Viewer control.

I created a new Winform project then added a renamed version of the Company Sales.rdl report which is included in SQL Server 2005's AdventureWorks sample reports. I basically renamed the thing to Company Sales.rdlc so I could use it client-side.

Anyway, I "Add Existing" in the winform project to get my Company Sales.rdlc item added, and then I create a dataset which will contains the data my report needs. No problems.

Next, I drop a Report Viewer control on my form, and use Smart Tags to point my viewer to the report and it's datasource. When I try to debug the app, I got the following error:

"The report defintion for report 'WindowsApplication1.Company_Sales.rdlc' has not been defined"

This message struck me as funny since I absolutely set the name of the report I wanted to display. After looking a bit more closely, I noticed the underscore character in the report name. It appears that Whidbey fixed up my report name in the ReportEmbeddedResource property, replacing the space in "Company Sales" with an underscore -- This broke me. In Solution Explorer I renamed the report (removing the space), then re-selected my report name in the report viewer control. That did did the trick...