How to Implemented RDLC Reports with Parameters in Web Applications


Through-out the article we will learn step-by-step: How to retrieve the values from the database and show it into the RDLC Report using ASP.NET. This is pass the parameter value to the database and retrieve it. How to get Data Collection and assign the Report viewer I have mention below.

Abstract


Through-out the article we will learn step-by-step: How to retrieve the values from the database and show it into the RDLC Report using Dotnet Framework.

we will learn step-by-step: How to retrieve the values from the database and show it into the RDLC Report using ASP.NET.

Introduction


In these days, Dotnet framework is most growing framework and as a developer I am curious to know and learn about the new features of this framework.

From last couple of days I was wondering How can retrieve the values from the database and show it into the RDLC Report using parameters in ASP.NET. For the same I have gone through various forums etc. Unfortunately, I did saw very few posts/articles for the same.

Finally, I tried and came with a solution to perform retrieve the values from the database and show it into the RDLC Report from Server side . In this article, I am going to share my findings with all of you.

Why Step-by-Step



Ah! This question came to my mind while I was finding the solution of my problem, I jotted down few points and finally
called them as a steps to perform How to retrieve the values from the database and show it into the RDLC Report using ASP.NET the database Operations.

Pre-requisite



To implement the solution and to feel the taste of code, you should:

Have Visual Studio 2012 or later with the support of VS

Have Basic Idea of SQL Server

Have Basic Idea of Sql queries



Step1:


start->Create new Project -> Asp.net Web Forms Application and Given File name then click ok

Create New Project in asp.net



Step2:


How to Add New --> Web Form given name click add button


Step3:


How to Add Dataset

Right Click the Click Add-> New Item -> Data -> Dataset Given name and click add button

Select Dataset with datatable


Select Dataset with Table



Step4:



Final output this

Final output

Report Generate Aspx Page this


<rsweb:ReportViewer ID="ReportViewer2" runat="server" Visible="false" Height="687px" Width="1045px">
<LocalReport ReportPath="Report1.rdlc"></LocalReport>
</rsweb:ReportViewer>



Server Side Code


ReportViewer2.Visible = true;
using (SqlConnection con = new SqlConnection(strCon))
{
SqlDataAdapter sqladp = new SqlDataAdapter("Select * from tblProducts where EmpName like '%"+ TxtName.Text +"%'", con);
sqladp.Fill(dt);
}
try
{
ReportViewer2.ProcessingMode = ProcessingMode.Local;
ReportViewer2.LocalReport.ReportPath = Server.MapPath("~/Report1.rdlc");
ReportDataSource rds = new ReportDataSource("DataSet1", dt);
ReportViewer2.LocalReport.DataSources.Clear();
ReportViewer2.LocalReport.DataSources.Add(rds);
}
catch (Exception ex)
{
//return null;
}


Hope it will helpful to you


Attachments

Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: