从C#windows应用程序调用SSRS报告

时间:2015-02-09 00:03:10

标签: c# windows reporting-services

我在SSRS中创建的报告工作正常,在构建器上显示所需的记录。

现在我想从Windows应用程序调用LOCALREPORT报告。我已经通过参数require for report。但它显示错误A data source instance has not been supplied for the data source Dataset1

代码如下:

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();

1 个答案:

答案 0 :(得分:1)

您正在本地处理,但您的报告是" Result.rdl"。 RDL文件通常在SSRS服务器的上下文中运行。在ReportViewer控件中本地运行的报表通常具有RDLC扩展名,并使用其设计器在Visual Studio中创建。

是否有一些理由不在ReportViewer控件上使用远程处理模式?如果你试图从混合中消除SSRS服务器,我认为你必须将RDL报告转换为RDLC。它们非常相似但不完全相同。这是一篇讨论相反翻译的文章,但可能会有所启发 - https://msdn.microsoft.com/en-us/library/ms252109.aspx

如果使用Visual Studio中的设计器创建简单的RDLC报表,然后将其拖到表单上,您将看到Visual Studio创建了一个DataSet,BindingSource和TableAdapter来读取报表的数据。我认为您需要做类似的事情来阅读您的数据。

当然,如果它是一个简单的报告 - 您可以在VS报告设计器中重新创建。