reports and variables RRS feed

  • Question


    please help i have an application variable i want to use it in a report .rdlc file

    thanks in advance

    Wednesday, December 12, 2007 5:39 PM

All replies

  • could you give a bit more detail?


    Do you mean you have a value in your code that you want to pass to your report?


    If so, you want to create a parameter in the report, and then in code pass the parameter to the report.

    Wednesday, December 12, 2007 7:13 PM

    yes exactly

    after creating the report parameter what to do in the code ?


    Thursday, December 13, 2007 7:12 PM
  • In your code you need to do this



    string detail1 = "MyValue";

    string detail2 = "MyOtherValue";

    ReportParameter param1 = new ReportParameter("param1", detail1); //declare a report Param, and set it's value

    ReportParameter param2 = new ReportParameter("param2", detail2); //declare another Param and set it's value

    ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { param1,param2}); //attaches all our parameters




    "param1" and "param2" are the names you gave the parameters when you created them in the report

    Thursday, December 13, 2007 7:19 PM

    thanks for ur reply

    ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { param1,param2});

    i have tried the  above line of code. when try to type ReportViewer. nothing came up and there is no existance for


    any thing should i import first ?

    thanks again

    Thursday, December 13, 2007 7:28 PM


    i think there is a bug in this issue every thing seems  to be perfect !!

    i have created a report parameter in the report named para


    in th code of the form that containig the reportViewer of my report


    import Microsoft.Reporting.Winforms.*;



    ReportParameter para = new ReportParameter("para",login.user);

    reportViewer1.// Here while doing this nothing came up  and there is no existence for LocalReport class ?


    Saturday, December 15, 2007 8:00 AM
  • everything I'm doing is in C# in webforms...but here is what I have


    References are




    and my using statement"imports" is


    using Microsoft.Reporting.WebForms;


    Monday, December 17, 2007 6:28 PM