Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/reporting-services/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 在运行时修改SSRS中的SQL查询_Asp.net_Reporting Services - Fatal编程技术网

Asp.net 在运行时修改SSRS中的SQL查询

Asp.net 在运行时修改SSRS中的SQL查询,asp.net,reporting-services,Asp.net,Reporting Services,有没有办法在运行时使用一些代码修改SQL查询?我有一个ASP.NET应用程序,我希望在不添加参数的情况下将数据传递给SSRS报告。谢谢。您可以将数据集从ASP.NET传递到ReportViewer控件 DataSet ds = GetDataSet(); ReportViewer1.LocalReport.ReportPath = “ReportServer/myReport.rdlc”; ReportViewer1.LocalReport.DataSources.Add(new ReportD

有没有办法在运行时使用一些代码修改SQL查询?我有一个ASP.NET应用程序,我希望在不添加参数的情况下将数据传递给SSRS报告。谢谢。

您可以将数据集从ASP.NET传递到ReportViewer控件

DataSet ds = GetDataSet();
ReportViewer1.LocalReport.ReportPath = “ReportServer/myReport.rdlc”;
ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource(”ds”, ds.Tables[0]));

谢谢你回答我的问题。我收到以下错误消息:我收到此行的错误:DataSet ds=GetDataSet();错误1当前上下文中不存在名称“GetDataSet”。GetDataSet方法只是一个伪填充符。您需要创建一个方法,该方法负责获取可传递给报表查看器的数据集。我需要能够在运行时更改ssrs报表中的sql查询。最好的方法是什么?我可以在Crystal Report中做到这一点,但在SSRS Report中无法做到。这非常令人沮丧。我的建议是不要更改SSRS报告中的查询。相反,使用数据集在代码中填充查询,然后将该数据集发送到SSRS报告。这样,SSRS报告中不需要任何查询,它只是充当主机。另一种选择是在由SSRS报告调用的存储过程中使用动态sql,以使其成为动态的。