Home > DeveloperSection > Forums > How to view Reports in C# Using Microsoft Report Viewer??
mohan kumar

Total Post:10

Posted on    April-19-2012 4:30 AM

 C# C# 

 0 Reply(s)
 4764  View(s)
Rate this:
This is my code. I cant able to load the reports in my page.

 public void loadReports()
        conn.open( );
        string strQry="SELECT Empid,Empname,location,Mobile,Pincode,Salary FROM Employee";
        DataTable dt = new DataTable();
        ReportViewer1.ShowBackButton = true;
        ReportViewer1.ShowPrintButton = true;
        ReportViewer1.ShowRefreshButton = true;
        //string strConn = System.Configuration.ConfigurationManager.AppSettings["ConnectionString"];
        SqlDataAdapter adp = new SqlDataAdapter(strQry,conn);
        this.ReportViewer1.Visible = true;
        this.ReportViewer1.LocalReport.ReportPath = "Report1.rdlc";
        ReportDataSource RDS = new ReportDataSource();
        RDS.Value = SqlData;
        conn.close( );

and my Default.aspx code is

        <rsweb:ReportViewer ID="ReportViewer1" runat="server" ProcessingMode="Remote">
        <LocalReport ReportPath="Report1.rdlc">
                <rsweb:ReportDataSource DataSourceId="SqlData" />
        <asp:SqlDataSource ID="SqlData" runat="server"
            ConnectionString="<%$ ConnectionStrings:masterConnectionString2 %>"
            SelectCommand="SELECT [Empid], [Empname], [location], [Mobile], [Pincode], [Salary] FROM [Employee]">

Please try to find errors why i can't able to load reports using the above code. When the above code is run,only white page appears.

Don't want to miss updates? Please click the below button!

Follow MindStick