2

I have a ReportViewer control in a WindowsFormsHost tag in my WPF application. When I use this code:

    rptViewer1.LocalReport.ReportPath = ...

    List<ReportParameter> parms = new List<ReportParameter>();
    parms.Add(new ReportParameter("regionID", "01"));
    rptViewer1.LocalReport.SetParameters(parms);

    rptViewer1.RefreshReport();

I get an error about a data source instance not being supplied. I can run the stored procedure manually and then use it to populate a datasource object, like...

var dt = DAL.GetData()
var rds = new ReportDataSource("DataSet1", dt);
rptViewer1.LocalReport.DataSources.Add(rds);

And this will cause the report to display, but then I am passing in my parameters to the GetData() method rather than to the report; this doesn't seem right. In my SSRS project, I am using a shared datasource, and it allows me to pass in the parameters on the report front end as I would expect. What am I doing wrong?

1 Answer 1

1

If you are using ProcessingMode = Local, then YOU are responsible for large portions of teh report. You or your application defined which parameters there are, how data is loaded, & what sub-report or drill through events do. You must explicitly code these. If the ProcessingMode = Remote, then all of these elements are handled by the reporting server. Microsoft doesn't spell this out very clearly in MSDN, but I can see their justification being "if you are going to host the report in your app, then you can be responsible for all the details".

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.