Reputation: 1454
I am trying to load a report that filters by the name in textbox1 but I am getting the error "An attempt was made to set a report parameter 'Name' that is not defined in this report" Any ideas?
Dim ds As New TestDataSetTableAdapters.tblTestDataTableAdapter
' Create report data source
Dim ID As ReportParameter
ID = New ReportParameter("Name", TextBox1.Text)
Dim rds As New ReportDataSource("MyApplication_ModelObject", ObjectDataSource1)
' Clear the datasets in the report viewer and add the new datasource
ReportViewer1.LocalReport.DataSources.Clear()
ReportViewer1.LocalReport.DataSources.Add(rds)
ReportViewer1.LocalReport.SetParameters(ID)
ReportViewer1.LocalReport.Refresh()
Upvotes: 9
Views: 40491
Reputation: 1151
The Name
part of the ReportParameter must match the name of the parameter in the Report.
It's probably @Name
, best this to do is to open the report and check there.
Upvotes: 4