none
Passing parameters as dataset to .RDLC report RRS feed

  • Question

  • Hi All !!! 

    Trying to add parameter to a .rdlc report. The parameter should show up the DB values for selection instead of the user typing in the values. I have defined a separate dataset for it. but couldn't find where to match the dataset to the defined parameters as like we do in Business Intelligence.

    Kindly let me know how can the dataset be linked with the newly created parameter from 'Report parameter'

    Thanks ,

    Meera.

    Friday, July 2, 2010 10:48 AM

Answers

  • You need to pass the paramaters in an collection like an arry or list. Here is a snippet of some code I used;

    Param = new ReportParameter[5];
    Param[0] = new ReportParameter("parCreateDate", "Created " + DateTime.Today.ToShortDateString());
    Param[1] = new ReportParameter("parReportName", programName);
    Param[2] = new ReportParameter("parOffice", tmpOffice);
    Param[3] = new ReportParameter("parParamaters", tmpParameters);
    Param[4] = new ReportParameter("parSortOrder", tmpSortOrder);
    myViewer.LocalReport.SetParameters(Param);
    

    Does this help any?

    Bernie

     

    • Marked as answer by Radhai Thursday, August 12, 2010 4:57 AM
    Saturday, July 3, 2010 4:21 PM
  • Sorry, I didn't see your reply.

    Where is your code to load the report into the report viewer?

    Also, go here;

    http://www.gotreportviewer.com/

    Look on the right hand column for Intereactive Sort. Download that example. I think it is doing exactly what you want.

    Bernie

     

    • Marked as answer by Radhai Thursday, August 12, 2010 4:57 AM
    Monday, July 12, 2010 6:11 AM

All replies

  • You need to pass the paramaters in an collection like an arry or list. Here is a snippet of some code I used;

    Param = new ReportParameter[5];
    Param[0] = new ReportParameter("parCreateDate", "Created " + DateTime.Today.ToShortDateString());
    Param[1] = new ReportParameter("parReportName", programName);
    Param[2] = new ReportParameter("parOffice", tmpOffice);
    Param[3] = new ReportParameter("parParamaters", tmpParameters);
    Param[4] = new ReportParameter("parSortOrder", tmpSortOrder);
    myViewer.LocalReport.SetParameters(Param);
    

    Does this help any?

    Bernie

     

    • Marked as answer by Radhai Thursday, August 12, 2010 4:57 AM
    Saturday, July 3, 2010 4:21 PM
  • Dear Bernie, Thanks for replying.

    Yes this does help me a little. 

    Kindly do let me know how to proceed. I have designed a report in RDLC and making it appear in a Form.

    The Code of form looks like the following, 

    Private Sub Form
      'TODO: This line of code loads data into the 'SQ.Sales_Table' table. You can move, or remove it, as needed.
    
            Me.Sales_TableTableAdapter.Fill(Me.SQ.Sales_Table
    End Sub

     

     

    Should i add any parameter variable to the report? Can the parameter be linked to a dataset?

    Else how can i write the coding to pass parameter to the report which is got embedded in the form?

    As i an new to Coding, i sort ur kind help. 

    Thanks in Advance,

    Meera.

     

     

    Tuesday, July 6, 2010 6:59 AM
  • No help ???

     

    Please help me ....

    Monday, July 12, 2010 5:44 AM
  • Sorry, I didn't see your reply.

    Where is your code to load the report into the report viewer?

    Also, go here;

    http://www.gotreportviewer.com/

    Look on the right hand column for Intereactive Sort. Download that example. I think it is doing exactly what you want.

    Bernie

     

    • Marked as answer by Radhai Thursday, August 12, 2010 4:57 AM
    Monday, July 12, 2010 6:11 AM