Skip to main content

Steps to create .rdlc report in c#, asp.net

Steps to create .rdlc report in c#, asp.net

Step 1 : Create a Query and get the data from your database ..
Step 2: Add DataSet Item 
        2.1 Right click on your website and select ADD NEW ITEM option
        2.2 Select DataSet.xsd and give the name .... view below image and add one table same as your query is giving result ...
Step 3: After adding table you have to add the .rdlc report to your project 
        3.1 Right click on your website and select ADD NEW ITEM option
        3.2 Select Report.rdlc and give the name .... view below image and add one table same as your query.
        3.3 One Report page is Appear Right click on the Report page and select Insert and then Table option
 
        
   3.4 Just add fields to table 
Step 4: After that just you have to call the report by using your .aspx page ...
Step 5 :  
Create one .aspx Page 
//-------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="PageName.aspx.cs"
    Inherits="Report
Page" %>
<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
    Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <rsweb:reportviewer id="RptViewer" runat="server" font-names="Verdana" font-size="8pt"
        height="800px" interactivedeviceinfos="(Collection)" waitmessagefont-names="Verdana"
        waitmessagefont-size="14pt" width="900px">
                <LocalReport ReportPath="Report\Reseller\RdlcFile\rptResellerAccountingInfo.rdlc">
                    <DataSources>
                        <rsweb:ReportDataSource DataSourceId="ObjectDataSource1" Name="DataSet1" />
                    </DataSources>
                </LocalReport>
            </rsweb:reportviewer>
    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" TypeName="DataSet1TableAdapters.">
    </asp:ObjectDataSource>
    </form>
</body>
</html>
using Microsoft.Reporting.WebForms;
put this code in your function to load reportViewer 
DataSet ds = new DataSet();
ds = //------------------Fill this database by your code
ReportDataSource rds = new ReportDataSource("DataSet1", ds.Tables[0]);
RptViewer.LocalReport.DataSources.Clear();
RptViewer.LocalReport.DataSources.Add(rds);
RptViewer.LocalReport.Refresh(

Comments

Popular posts from this blog

Creating package in Oracle Database using Toad For Oracle

What are Packages in Oracle Database A package is  a group   of procedures, functions,  variables   and  SQL statements   created as a single unit. It is used to store together related objects. A package has two parts, Package  Specification  and Package Body.

Resolving 'Setup Account Privileges' error while installing SQL Server

A new installation of Microsoft SQL Server 2012 or Microsoft SQL Server 2008 R2 fails You see the following error message when you try to install a new instance of SQL Server 2012 or SQL Server 2008 R2: Rule "Setup account privileges" failed.

Creating Oracle stored Procedures using TOAD for Oracle

In a database management system, a  stored procedure  is a set of Structured Query Language (SQL) statements with an assigned name that's stored in the database in compiled form so that it can be shared by a number of programs. The use of  stored procedures  can be helpful in controlling  access to data, preserving  data integrity  and  improving  productivity.