none
Parameter in reports using VisualStudio 2008 RRS feed

  • Question

  •  

    Hi¡¡

    I have a litle trouble using Reports on VisualStudio 2008

    I need send some parameters to the reports like city, or mov type,  but the report don't not show this,I know that reports now is different than in VS2003 or VS2005

    Could you help me to give some tips to use reports in VS2008 ?

    Thanks

     

     

    Friday, February 29, 2008 6:07 PM

All replies

  • They work differently depending on if your doing .rdl or .rdlc  type report.... here is an example for a local report (.rdlc)

     

    you just have to manually handle the prompting if required.  Here is an example.

     

    Code Snippet

     

    DataSet ReportDataSet = new DataSet();

    //Fill Dataset

     

     

    ReportParameter instName = new ReportParameter("InstName", ReportDataSet.Tables[1].Rows[0]["Name"].ToString());

    ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { instName });

     

     

    and to display the value in the report itself You would use the expression

     

    =Parameters!InstName.Value

     

     

    to create parameters in a report, right click the blank area when in the report designer and choose parameters

     

    Friday, February 29, 2008 7:31 PM
  • Its Amazing¡¡¡, but do you know how do this using Visual Basic?

    Friday, February 29, 2008 8:06 PM
  • Code Snippet

    Dim ReportDataSet As New DataSet()

    'Fill Dataset

     

     

    Dim instName As New ReportParameter("InstName", ReportDataSet.Tables(1).Rows(0)("Name").ToString())

    ReportViewer1.LocalReport.SetParameters(New ReportParameter() {instName})

     

     

     

    vb code above,

     

    Friday, February 29, 2008 8:08 PM