none
Passing parameters to the Microsoft Report Viewer in VS 2008 RRS feed

  • Question

  • The have given the code below, pass the parameters to Reportviewer in a local mode.

    DataSet DsInout = new DataSet();
    DsInout = obj_Service.Get_DaysInoffice(Obj_App);
    ReportParameter[] param = new ReportParameter[5];
    param[0] = new ReportParameter("CompName", TCSession.Company, false);
    param[1] = new ReportParameter("LocName", TCSession.Location, false);
    param[2] = new ReportParameter("OrgName", TCSession.Organisation, false);
    param[3] = new ReportParameter("Lineno", TCSession.LineNo, false);
    param[4] = new ReportParameter("cuid", TCSession.UserID, false);
    RptViewer.ProcessingMode = icrosoft.Reporting.WebForms.ProcessingMode.Local;
    RptViewer.LocalReport.ReportPath = Server.MapPath(@"rdlReports\rptWorkDays.rdlc");
    RptViewer.LocalReport.DataSources.Clear();
    Microsoft.Reporting.WebForms.ReportDataSource datasource = new
    Microsoft.Reporting.WebForms.ReportDataSource("DsInout_PunchDetails", DsInout.Tables[0]);
    RptViewer.LocalReport.DataSources.Add(datasource);
    RptViewer.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("DsInout_PunchDetails", DsInout.Tables[0]));
    RptViewer.LocalReport.SetParameters(param);
    this.RptViewer.LocalReport.Refresh();
    RptViewer.DocumentMapCollapsed = true;

    I have debugged the above code and checked the values of the parameters. The name which passed to the parameter's are set properly but value's are set to blank. Please guide me to resolve this issue.

    Thanks & regards

     

    • Moved by liurong luo Monday, June 28, 2010 7:31 AM not a debugger issue. (From:Visual Studio Debugger)
    Friday, June 25, 2010 6:16 AM

All replies

  • Hello,

    I'm moving this thread from base "Visual Studio Debugger" forum to "Visual Studio Report Control" forum for more support. There are more experts there to provide professional support. Thanks for your understanding!

    Best regards


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback, please tell us.
    Welcome to the All-In-One Code Framework!
    Monday, June 28, 2010 7:31 AM
  • Are you positive that TCSession is populated with data at the time is is used?

    Also try passing only two paramaters, like this;

    param[0] = new ReportParameter("CompName", TCSession.Company);
    param[1] = new ReportParameter("LocName", TCSession.Location);
    param[2] = new ReportParameter("OrgName", TCSession.Organisation);
    param[3] = new ReportParameter("Lineno", TCSession.LineNo);
    param[4] = new ReportParameter("cuid", TCSession.UserID);

    Also II, how about moving the SetParameters(param) line up to just after you assign the params and before you assign the data.

    Just some it's that might shake something out.

    Bernie

    Thursday, July 1, 2010 4:04 AM