user3513192
user3513192

Reputation: 107

Invoking SSRS report from C# windows application

I have Created report in SSRS which is working fine, on the builder displaying the records as required.

Now I want to invoke the report from windows application as LOCALREPORT. I have passed the parameter require for report. But it is displaying error A data source instance has not been supplied for the data source Dataset1

The code is as follows:

ReportV.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Local;
LocalReport localreport = ReportV.LocalReport;
localreport.ReportPath = "Result.rdl";
ReportParameter _para_sid = new ReportParameter();
_para_sid.Name = "s";
_para_sid.Values.Add("313");
ReportParameter _para_courseid = new ReportParameter();
_para_courseid.Name = "Cid";
_para_courseid.Values.Add("BSB50207");
ReportParameter[] _rp = new ReportParameter[2];
_rp[1] = _para_sid;
_rp[0] = _para_courseid;
localreport.SetParameters(_rp);
ReportV.RefreshReport();

Upvotes: 0

Views: 4928

Answers (1)

jefftrotman
jefftrotman

Reputation: 1114

You are processing locally but your report is "Result.rdl". RDL files are typically run in the context of an SSRS server. Reports run locally in the ReportViewer control usually have an RDLC extension and were created inside Visual Studio using its designer.

Is there some reason to not use Remote processing mode on the ReportViewer control? If you're trying to eliminate the SSRS server from the mix, I think you have to convert the RDL report to an RDLC. They are very similar but not exactly the same. Here's an article that discusses the opposite translation but may shine some light - https://msdn.microsoft.com/en-us/library/ms252109.aspx.

If you create a simple RDLC report using the designer inside Visual Studio and then drag it onto a form, you'll see that Visual Studio creates a DataSet, BindingSource and TableAdapter to read the data for the report. I think you'll need to do something similar to read your data.

Of course, if it's a simple report - you could just re-create in the VS report designer.

Upvotes: 1

Related Questions