Report Designer in Visual Studio 2005 – Case Sensitive Fields

April 9, 2007

If you’ve never worked with the report viewer control and the report designer in VS 2005, you should give it a try if you ever have a need for a reporting services report in your web application. Anyway, a colleague of mine at work was working on a report that I designed a few months earlier. Whenever I setup a reporting services report, I use the smart tag to create a datasource to start my design from. The smart tag will create a dataset which is what the report will in theory be bound to. At runtime, I always manually bind to a dataview that I get from a business layer class, and therefore only make use of the dataset name to tie my business class to the report. So in the method I use to run the report, I do something like this:

ReportDataSource rpds = new ReportDataSource();
rpds.Name = "DataSet1_DataTable1";
rpds.Value = dv;
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(rpds);
ReportViewer1.LocalReport.ReportPath = @"MyReport.rdlc";

where “DataSet1_DataTable1” is the name of the dataset / datatable created using the report designer smart tag, and “dv” is the local variable holding a DataView returned by my business class.

Anyway, we had a problem where one of the fields was not displaying on the report. After an hour of scratching our heads, we determined that the field names (columns in the dataview) in the report appear to be case sensitive. Once we had the case of the column name returned by the business class match the case in the dataset, the field would then display on the report. I am not certain if this is a bug with the report designer, or just a strange coicidence that matching the case fixed the problem.