生成报告从URL - SQL服务器报告服务2008

时间:2020-12-08 08:08:40

I have SQL Server Reporting Services 2008 and when I open the following URL:

我有SQL Server Reporting Services 2008,当我打开以下URL时:

"http://localhost/Reports/Pages/Report.aspx?someReport"

“http://localhost/Reports/Pages/Report.aspx?someReport”

I'm getting report screen in which I fill my parameters and generate a report,

我得到报告屏幕,我在其中填充参数并生成报告,

My question is how can I do this without any GUI? by batch file or C# script..

我的问题是,在没有任何GUI的情况下,我怎么做呢?通过批处理文件或c#脚本。

Thanks in advance.

提前谢谢。

=========================================================================

= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

EDIT:

编辑:

Thanks to all answer above I succeed to generate a report and save it as an XML using the following link:

感谢以上所有的回答,我成功地生成了一个报告,并将它保存为XML使用以下链接:

"http://Server/ReportServer/Pages/ReportViewer.aspx?someReport&dFrom=01/01/2012&dTo=08/08/2012&rs%3AFormat=XML"

“http://Server/ReportServer/Pages/ReportViewer.aspx?someReport&dFrom=01/01/2012&dTo=08/08/2012&rs%3AFormat=XML”

Thanks for you all!!!

谢谢大家! ! !

4 个解决方案

#1


16  

Your problem is you are passing parameters to http://server/reports... you need to pass parameters to http://server/reportserver...

您的问题是您正在向http://server/reports.中传递参数。您需要将参数传递给http://server/reportserver..。

I remember this issue I had when I first started using Reporting Services.

我记得我第一次使用报告服务时遇到的这个问题。

Here's the MSDN that may help you: http://msdn.microsoft.com/en-us/library/ms155391.aspx

以下是可能对您有所帮助的MSDN: http://msdn.microsoft.com/en-us/library/ms155391.aspx

For example, to specify two parameters, “ReportMonth” and “ReportYear”, defined in a 
report, use the following URL for a native mode report server:

http://myrshost/ReportServer?/AdventureWorks 2008R2/Employee_Sales_Summary_2008R2&ReportMonth=3&ReportYear=2008

The result is like so:

结果是这样的:

http://myRSServer/ReportServer/Pages/Report.aspx?%2fDefaultTenant%2fDialing+Reports%2fDialing+Agent+Performance&dFrom=01/01/2012&dTo=08/08/2012

http://myRSServer/ReportServer/Pages/Report.aspx?%2fDefaultTenant%2fDialing + % 2 fdialing报告+代理+ Performance&dFrom = 01/01/2012&dTo = 08/08/2012

If you want to export the report to excel / pdf / etc you can append it:

如果您想将报告导出到excel / pdf /等,您可以添加:

For excel: &rs:Format=Excel

excel:rs:= excel格式

For PDF: &rs:Format=PDF

对于PDF:rs:= PDF格式

This should help as well: http://www.mssqltips.com/sqlservertip/1336/pass-parameters-and-options-with-a-url-in-sql-reporting-services/

这也应该有所帮助:http://www.mssqltips.com/sqlservertip/1336/ pass-parameterandoptions -with-a-url-in-sql- reportingservices/

#2


1  

Your second URL option is the closest, you pass the date parameters without quotes. As JonH states you want to use ReportServer instead of Reports, and you also want to remove ItemPath=

第二个URL选项是最接近的,您传递没有引号的日期参数。正如JonH所说,您希望使用ReportServer而不是报表,您还希望删除ItemPath=

http://Server/ReportServer/Pages/Report.aspx?%2fDefaultTenant%2fDialing+Reports%2fDialing+Agent+Performance&dFrom=01/01/2012&dTo=08/08/2012

Additionaly, if you want to export the file you can append &rs:command=render&rs:format=PDF replacing PDF with the format you desire

另外,如果您想要导出文件,可以添加&rs:command=render&rs:format=PDF替换为您想要的格式

#3


0  

string URL = "YourReportUrl";     
string FullURL = URL + "&JobId=" + JobId.ToString() + "&JobNumber=" + JobNo.ToString() + "&rs%3aCommand=Render";

Where JobId and JobNumber will be your Parameter names. This will directly open in your report Viewer.

其中JobId和JobNumber是参数名。这将直接在您的报表查看器中打开。

To display in XML format, add this &rs%3AFormat=XML to end of URL.

要以XML格式显示,请将&rs%3AFormat=XML添加到URL的末尾。

string FullURL = URL + "&JobId=" + JobId.ToString() + "&JobNumber=" + JobNo.ToString() + "&rs%3aCommand=Render&rs%3AFormat=XML";

#4


0  

Following is an example for using URL for a report. It passes parameters and also specify whether the parameters should be hidden or not

下面是一个为报表使用URL的示例。它传递参数并指定参数是否应该隐藏

http://myServer/ReportServer/Pages/ReportViewer.aspx?/InventoryTracking/Receiving/InboundContainerID
&rs:Command=Render&rc:Parameters=false&Plant="20"

If are using HTML file to display this, then use

如果是使用HTML文件来显示,则使用

window.location.href = url;

#1


16  

Your problem is you are passing parameters to http://server/reports... you need to pass parameters to http://server/reportserver...

您的问题是您正在向http://server/reports.中传递参数。您需要将参数传递给http://server/reportserver..。

I remember this issue I had when I first started using Reporting Services.

我记得我第一次使用报告服务时遇到的这个问题。

Here's the MSDN that may help you: http://msdn.microsoft.com/en-us/library/ms155391.aspx

以下是可能对您有所帮助的MSDN: http://msdn.microsoft.com/en-us/library/ms155391.aspx

For example, to specify two parameters, “ReportMonth” and “ReportYear”, defined in a 
report, use the following URL for a native mode report server:

http://myrshost/ReportServer?/AdventureWorks 2008R2/Employee_Sales_Summary_2008R2&ReportMonth=3&ReportYear=2008

The result is like so:

结果是这样的:

http://myRSServer/ReportServer/Pages/Report.aspx?%2fDefaultTenant%2fDialing+Reports%2fDialing+Agent+Performance&dFrom=01/01/2012&dTo=08/08/2012

http://myRSServer/ReportServer/Pages/Report.aspx?%2fDefaultTenant%2fDialing + % 2 fdialing报告+代理+ Performance&dFrom = 01/01/2012&dTo = 08/08/2012

If you want to export the report to excel / pdf / etc you can append it:

如果您想将报告导出到excel / pdf /等,您可以添加:

For excel: &rs:Format=Excel

excel:rs:= excel格式

For PDF: &rs:Format=PDF

对于PDF:rs:= PDF格式

This should help as well: http://www.mssqltips.com/sqlservertip/1336/pass-parameters-and-options-with-a-url-in-sql-reporting-services/

这也应该有所帮助:http://www.mssqltips.com/sqlservertip/1336/ pass-parameterandoptions -with-a-url-in-sql- reportingservices/

#2


1  

Your second URL option is the closest, you pass the date parameters without quotes. As JonH states you want to use ReportServer instead of Reports, and you also want to remove ItemPath=

第二个URL选项是最接近的,您传递没有引号的日期参数。正如JonH所说,您希望使用ReportServer而不是报表,您还希望删除ItemPath=

http://Server/ReportServer/Pages/Report.aspx?%2fDefaultTenant%2fDialing+Reports%2fDialing+Agent+Performance&dFrom=01/01/2012&dTo=08/08/2012

Additionaly, if you want to export the file you can append &rs:command=render&rs:format=PDF replacing PDF with the format you desire

另外,如果您想要导出文件,可以添加&rs:command=render&rs:format=PDF替换为您想要的格式

#3


0  

string URL = "YourReportUrl";     
string FullURL = URL + "&JobId=" + JobId.ToString() + "&JobNumber=" + JobNo.ToString() + "&rs%3aCommand=Render";

Where JobId and JobNumber will be your Parameter names. This will directly open in your report Viewer.

其中JobId和JobNumber是参数名。这将直接在您的报表查看器中打开。

To display in XML format, add this &rs%3AFormat=XML to end of URL.

要以XML格式显示,请将&rs%3AFormat=XML添加到URL的末尾。

string FullURL = URL + "&JobId=" + JobId.ToString() + "&JobNumber=" + JobNo.ToString() + "&rs%3aCommand=Render&rs%3AFormat=XML";

#4


0  

Following is an example for using URL for a report. It passes parameters and also specify whether the parameters should be hidden or not

下面是一个为报表使用URL的示例。它传递参数并指定参数是否应该隐藏

http://myServer/ReportServer/Pages/ReportViewer.aspx?/InventoryTracking/Receiving/InboundContainerID
&rs:Command=Render&rc:Parameters=false&Plant="20"

If are using HTML file to display this, then use

如果是使用HTML文件来显示,则使用

window.location.href = url;