locked
Report Viewer RDLC Local Examples VS2010 - Sql Server Stored Procedure RRS feed

  • Question

  • User-1367260019 posted

    Hi I cannot seem to get a simple report to work using codebehind to populate a report and I'm also confused how they work.

    using - Microsoft.ReportViewer.WebForms, Version=10.0.0.0

    Firstly to create a report I have to create a dataset within my project (I dont want to do this as I just want to populate the report with data from my Business Access Layer which will go and get a table of data for the datasource.

    First Question is can I create the report based on a dataset, then get rid of it and then supply the data for the report with code behind?

    This is my code behind that does not want to work, what am I doing wrong?

    Question: I do not understand what rds.Name is doing.

    If I then run the report with this code behind I get:

    An error occurred during local report processing.
    The report definition for report 'E:\Project\MyCompanies.rdlc.rdlc' has not been specified
    Could not find file 'E:\ProjectMyCompanies.rdlc.rdlc'.
    

     

                ReportViewer1.ProcessingMode = ProcessingMode.Local;
                ReportViewer1.Reset();
                ReportViewer1.LocalReport.Dispose();
                ReportViewer1.LocalReport.DataSources.Clear();
                ReportDataSource rds = new ReportDataSource();
                rds.Name = "MyDataSet";
                DataTable dt = new CompaniesBAL().GetCompanyName();
                rds.Value = dt;
                ReportViewer1.LocalReport.ReportPath = "MyCompanies.rdlc";
                ReportViewer1.LocalReport.DataSources.Add(rds);
                ReportViewer1.LocalReport.Refresh(); 
     
    Any help would be appreciated.
    Could not find a dedicated report forum, is there one?

     

     

    Tuesday, April 3, 2012 9:08 PM

Answers

  • User-8475372 posted

    In place of 

    ReportViewer1.LocalReport.ReportPath = "MyCompanies.rdlc";
    Give
    ReportViewer1.LocalReport.ReportPath = "MyCompanies";
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, April 9, 2012 2:49 AM

All replies