Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Reporting Services Development
 How to send value to report in Reporting Services

Author  Topic 

hdv212
Posting Yak Master

140 Posts

Posted - 2007-11-09 : 02:20:37
hi
i have a reportViewer in my form and a report in reportDesigner named 'Report1.rdlc'.
in my report, i define a parameter that has these properties :
Name = Report_Parameter_0
Data type = String
Promt = 11111111111111
Allow blank value = true
Null = true

and add a textBox to my report in reportDesigner with following properties :
Name = textbox5
Value = Parameters!Report_Parameter_0.Value

and in my form load event that show report i wrote this code to send my value to 'Report_Parameter_0' programmatically :
try
{
this.v_customerOrderCountTableAdapter.Fill(this.NorthwindDataSet.v_customerOrderCount);
Microsoft.Reporting.WinForms.ReportParameter rp = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_0", "Param From Code");
this.reportViewer1.LocalReport.SetParameters(new Microsoft.Reporting.WinForms.ReportParameter[] { rp });
this.reportViewer1.RefreshReport();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}

with above information, in runTime, i prospected that 'textbox5' have 'Param From Code' value, but have
'Parameters!Report_Parameter_0.Value' yet.
where does problem and how to send value to reportParameter correctly ?
thanks
   

- Advertisement -