none
Parameters RRS feed

  • Question

  • I have created a report in SSRS with 2 parameters, "ClientID" and "Date", and so whenever I want to run the program, I just have to add in the ClientID # and assign a date.  I am now re-creating the same report in VisualStudio2010, C#, Reports Application, and not too sure how to incorporate the same parameters here.

    I have control+Alt+D, and have the Report Data window open, however, when I add parameters and run the report I get the following: The 'ClientID' parameter is missing a value  - how can I solve this issue?

    And my second question, is that is how to add in multiple DataSets in the same report? to add dataset, I go to my database in the report data section, right click and add dataset, however, once I do that and run my report I get this: A data source instance has not been supplied for the data source 'DataSet2'.

    Any help is greatly appreciated.

    Thanks

    Tuesday, August 14, 2012 5:16 PM

Answers

  • Hello,

    I understand you want to use a local report (an .rdlc file) in a Visual Studio project.

    If this is correct, you have to do everything in code.

    1) Local reports do not support parametered queries. This means you cannot specify the clientID and the selected date when starting the report. You have to create another way of entering those parameters, a simple form is usually chosen. The parameters have to be defined in the report file at design time. At run time, their values have to be passed to the report viewer with code such as :

    Dim myParametersAs ReportParameter()
    myParameters= New ReportParameter() _
                 {New ReportParameter("clientID", xxx)), _
                  New ReportParameter("selectedDate",yyy)}
    
    f.ReportViewer1.LocalReport.SetParameters(myParameters)
    

    2) The dataset has to be attached to the report at design time. At runtime, the corresponding datasource has to be passed to the reportviewer with code such as :

    f.ReportViewer1.LocalReport.DataSources.Add(myDataSource)
    

    • Marked as answer by PearlNa Wednesday, August 22, 2012 8:13 PM
    Tuesday, August 21, 2012 2:20 PM