Showing posts with label objectdatasource. Show all posts
Showing posts with label objectdatasource. Show all posts

Monday, February 20, 2012

ObjectDataSource not passing parameter to report viewer stored proc (sql server)

I have an ObjectDataSource feeding data to a report viewer control, but when I try to give the objectdatasource a parameter it should be expecting (based on the stored proc that's pulling the data) and the GetData method in the XSD file, I get the error:
An error has occurred during report processing.ObjectDataSource 'ObjectDataSource2' could not find a non-generic method 'GetData' that has parameters: Date.The table adapter in the XDS shows GetData(@.Date), and I'm trying to bind the objectdatasource to my report viewer like this:

PlaceHolder1.Controls.Clear()
Dim rv As New Microsoft.Reporting.WebForms.ReportViewer
PlaceHolder1.Controls.Add(rv)
rv.LocalReport.DataSources.Clear()
ObjectDataSource2.TypeName = "DS_ClosedProjectsSnap2TableAdapters.reports_closedin7days_2TableAdapter"
ObjectDataSource2.SelectParameters.Clear()
ObjectDataSource2.SelectParameters.Add("Date", d_collectiondate.SelectedValue)
ObjectDataSource2.DataBind()
rv.LocalReport.ReportPath = "secure\reports\ClosedProjectsSnap.rdlc"
rv.LocalReport.EnableHyperlinks = True
rv.LocalReport.DataSources.Clear()
rv.ProcessingMode = ProcessingMode.Local
rv.LocalReport.DataSources.Add(New ReportDataSource("DS_ClosedProjectsSnap2_reports_closedin7days_2", ObjectDataSource2))
rv.DataBind()

I can't see why this wouldn't work, so I would really appreciate any ideas anybody has.

Thanks

I used to have this error, but all I did to fix it was configure the datasource and make sure each paramter was assigned to textbox controls which i added above the ReportViewer.