Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Parameter Reporting
Hi,
 
I am using C# Reportviewer
 
I have a problem passing more than one parameter from my form textbox to report textbox.
 
When i only passed one meter like this it worked perfectly
this.reportViewer1.LocalReport.ReportPath = "Report2.rdlc";
     ReportParameter rp = new ReportParameter("InvoiceNumber", this.textBox2.Text);
     this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] {rp});
          
     this.reportViewer1.RefreshReport();
But now as soon as i try passing a second parameter like this it only shows Invoice number in my report and not Balance brought forward parameter
this.reportViewer1.LocalReport.ReportPath = "Report2.rdlc";
    ReportParameter rp = new ReportParameter("InvoiceNumber", this.textBox2.Text);
    ReportParameter rpt = new ReportParameter("BalanceBroughtForward",      this.textBox5.Text);
    this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] {rp});
    this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] {rpt});
         
    this.reportViewer1.RefreshReport();
Is my code maybe wrong for passing 2 parameter.
 
Can someone please assist me in this matter
 
Thanks in advance
Posted 22-Sep-12 23:28pm
Edited 22-Sep-12 23:30pm
v2

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

I'm not sure - and I can't test it at the moment - but since the SetParamaters method accepts an array, isn't it all a bit obvious:
 
    this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] {rp});
    this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] {rpt});
Becomes:
    this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] {rp, rpt});
  Permalink  
Comments
GoggatjieLiesl at 23-Sep-12 6:34am
   
I have tried this but still when i press button to generate report it only shows Invoice number in textbox but nothing in my BBF textbox

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 534
1 Gihan Liyanage 298
2 ChintanShukla 295
3 RyanDev 250
4 Richard Deeming 250
0 Sergey Alexandrovich Kryukov 8,906
1 OriginalGriff 7,771
2 CPallini 2,603
3 Richard MacCutchan 2,121
4 Abhinav S 1,928


Advertise | Privacy | Mobile
Web03 | 2.8.140827.1 | Last Updated 23 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100