none
Converting RDL to RDLC parameter reports for use in winform applications RRS feed

  • Question

  • We have many reports which have been built as .rdl files and I am trying to convert these to a C# .Net report viewer report.  All of these reports have at least two parameters up to as many as ten parameters.
    I have followed the steps as outlined here: http://msdn2.microsoft.com/en-us/library/ms252109(VS.80).aspx

    Step 3 says
    3.Create or add the dataset that defines the data you want to use to your projector solution. For more information, see Creating Data Sources for a ReportViewer Report.

    Do I need to create a dataset for each dataset to match the dataset in the RDLC file?
    I do understand that the dataset in Visual studio is different than the reporting dataset.

    So what I have done is I have tried to convert the report I have using only one dataset and many data tables.
    This failed to display the data.

    So I started over and then created a new project.  This time I created the same amount of datasets with a single data  table adapter under each, 4 to be exact.  I also named the datasets the same to match the report.  I have set everything up and ran the report and it appears the report is working, but I am not getting data to display on the report.  The datatable has data in it?  I am not sure what I am doing wrong.


    Here is my code:
                  this.dataTable1TableAdapter2.Fill(this.Main.DataTable1, "(Alt)", fDTMDateTimePicker.Value, cDTMDateTimePicker.Value, "(Alt)");
                // TODO: This line of code loads data into the 'customers.PickListValues' table.             this.pickListValuesTableAdapter.Fill(this.customers.PickListValues);
                // TODO: This line of code loads data into the 'getDefaultDates.DataTable1' table.
                this.dataTable1TableAdapter1.Fill(this.getDefaultDates.DataTable1);
                // TODO: This line of code loads data into the 'consultant.DataTable1' table. 
                this.dataTable1TableAdapter.Fill(this.consultant.DataTable1);
                SetReportParameters();
                this.reportViewer1.RefreshReport();

    I also would much like to not have to use the GUI datasources, etc through Visual studio, can I do this without using them?  If so, can someone point out a website or some code that shows me how to do this? 

    Thanks for your help

    Thursday, March 22, 2007 12:19 PM

Answers

  • I have resolved my issue.  It was a very simple problem, I setup a filter on the report.  The query has a parameter, which is controlled by a combo box, so the user can select (All) customers, for example, but the parameter '(All)' I was filtering on, is not in any records in the database table.  Therefore nothing is displayed in the report, but when I select another field in the combo box, everything is displaying properly.

    This was really a newbie mistake, but perhaps someone else will run into this and I will save them some time.

    Thanks Asif, I browsed over your tutorial and it looks very good.  I will review it later.

    Friday, March 23, 2007 10:37 AM

All replies

  • Just an update.  I changed the Datasource Datatable names from the Default to meaningful names and it seemed to resolve the issue of displaying the filtered parameters, but when I initially run the report for some reason it does not display any data.  What could cause this?  The Main dataset has like 150 records when I look at it while debugging.  I have this exact same behavior in another report, but don't know why.  Any help here would be appreciated.

    Also, as requested before, does anyone know of a good guide or steps to creating the datasources through code, not through the gui.  I feel the GUI is problematic and I want better control. 

    Thanks in advance.

    Thursday, March 22, 2007 3:55 PM
  • Hi,

    Please check my step-by-step tutorial on using reportviewer with windows forms. Hope it helps.

    http://www.codeproject.com/sqlrs/rswin101.asp

    Regards,

    Asif

    Thursday, March 22, 2007 8:19 PM
  • I have resolved my issue.  It was a very simple problem, I setup a filter on the report.  The query has a parameter, which is controlled by a combo box, so the user can select (All) customers, for example, but the parameter '(All)' I was filtering on, is not in any records in the database table.  Therefore nothing is displayed in the report, but when I select another field in the combo box, everything is displaying properly.

    This was really a newbie mistake, but perhaps someone else will run into this and I will save them some time.

    Thanks Asif, I browsed over your tutorial and it looks very good.  I will review it later.

    Friday, March 23, 2007 10:37 AM