While developing on ASP.NET, you may experience some difficulties or hard decisions with Reporting Services. Do you really need a Reporting Services Server installed and working for your ASP.NET applications to access the reports?
The answer is RDLC, which are the Reporting Services report files on ASP.NET applications. These are simple to create, but after creating the layout, when you attempt to load data from a SQL Server 2005 database, you'll find the issue - how can I map
DataSets to my report?
On RDL (Common Server Reporting Services), you can do this directly, but on RDLC, you will have to create your
DataSets on your Web Application/Project, and send the correct parameters to the report so it can get the respective data from the database and show it on the report.
Sounds simple, right? The problem is trying to find this code..
This article covers the existing gap on how to send
DataSets into an RDLC file so it can display a report with data.
Using the code
Even if the introduction or the concept sounds simple, you must apply the code carefully.
In the first place, drag and drop a
ReportViewer into your page (in the code, I'll name it as
protected void LoadReport(int lineNr)
SqlConnection sqlCon = new SqlConnection();
DataSet dsHeader = new DataSet();
DataSet dsDetail = new DataSet();
SqlParameter sqlParm = new SqlParameter("@intNr",
dsHeader = SqlHelper.ExecuteDataset(sqlCon,
dsDetail = SqlHelper.ExecuteDataset(sqlCon,
ReportDataSource reportDSHeader =
ReportDataSource reportDSDetail =
And then, you just need to call the
LoadReport method and pass the correct parameter, and you're set.
Points of interest
This way, you avoid using the Reporting Services Server, and you spare a lot of unwanted code. Your report will be together with the Web Application, so once you deploy your project, your report is already set, and there is no need to install it on any server.
You'll just need .NET Framework 2.0 and VS 2005 installed to develop/run this code.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.