Sponsored By
MindStick Cleaner
Advertise with Us
Advertisement
Advertise with Us
Follow Us
Follow _MindStick_ on Twitter View MindStick Software's LinkedIn profile View MindStick Software's Facebook profile
Mindstick
Article Article  Forum Forum  Blog Blog  Quiz Quiz  Beginner Beginner  Careers Careers  Contact Contact  Login Login  
Home | Product | Services | About Us | Interview | DeveloperSection | Submit an Article | Submit Blog
Report Abuse Form
Reason:    
   

Home >> .Net >> C# >> How to view Reports in C# Using Microsoft Report Viewer??
Author Post

mohan kumar


Total Post: 10
Member Since: 10/19/2011
Points: 51
How to view Reports in C# Using Microsoft Report Viewer??
Posted On: 4/19/2012 4:30:16 AM
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);
        adp.Fill(dt);
        this.ReportViewer1.Visible = true;
        this.ReportViewer1.LocalReport.ReportPath = "Report1.rdlc";
        ReportDataSource RDS = new ReportDataSource();
        RDS.Value = SqlData;
        this.ReportViewer1.LocalReport.DataSources.Add(RDS);
        ReportViewer1.DataBind();
        conn.close( );
               
    }

and my Default.aspx code is

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

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.
Modified On: 4/19/2012 4:32:15 AM
Report Abuse Form
Reason:    
 
Total Online Users: 2812
Advertisement
MindStick DataConverter
Advertise with Us
  
Copyright © 2009 - 2013MindStick. All Rights Reserved.