[英]SQL Server Reporting Services 2008 R2 - Folder and Report Security
[英]Generate report from URL - SQL Server Reporting Services 2008
我有SQL Server Reporting Services 2008,當我打開以下URL時:
“HTTP://localhost/Reports/Pages/Report.aspx someReport”
我正在獲取報告屏幕,我在其中填寫參數並生成報告,
我的問題是如何在沒有任何GUI的情況下執行此操作? 通過批處理文件或C#腳本..
提前致謝。
================================================== =======================
編輯:
感謝上面的所有答案,我成功生成了一個報告,並使用以下鏈接將其保存為XML:
的 “http://Server/ReportServer/Pages/ReportViewer.aspx someReport&DFROM = 01/01/2012&DTO = 08/08/2012和RS%3AFormat = XML”
謝謝大家!!!
您的問題是您將參數傳遞給http://server/reports...
您需要將參數傳遞給http://server/reportserver...
我記得第一次使用Reporting Services時遇到的這個問題。
以下是可能對您有所幫助的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
結果如下:
http://myRSServer/ReportServer/Pages/Report.aspx?%2fDefaultTenant%2fDialing+Reports%2fDialing+Agent+Performance&dFrom=01/01/2012&dTo=08/08/2012
如果要將報告導出到excel / pdf / etc,可以將其附加到:
對於excel: &rs:Format=Excel
對於PDF: &rs:Format=PDF
這也應該有所幫助: http : //www.mssqltips.com/sqlservertip/1336/pass-parameters-and-options-with-a-url-in-sql-reporting-services/
您的第二個URL選項是最接近的,您傳遞的日期參數不帶引號。 正如JonH所說,您希望使用ReportServer
而不是Reports
,並且還要刪除ItemPath=
http://Server/ReportServer/Pages/Report.aspx?%2fDefaultTenant%2fDialing+Reports%2fDialing+Agent+Performance&dFrom=01/01/2012&dTo=08/08/2012
另外,如果你想導出文件,你可以追加&rs:command=render&rs:format=PDF
用你想要的格式替換PDF
string URL = "YourReportUrl";
string FullURL = URL + "&JobId=" + JobId.ToString() + "&JobNumber=" + JobNo.ToString() + "&rs%3aCommand=Render";
JobId
和JobNumber
將成為您的參數名稱。 這將直接在報表查看器中打開。
要以XML格式顯示,請將此&rs%3AFormat=XML
到URL的末尾。
string FullURL = URL + "&JobId=" + JobId.ToString() + "&JobNumber=" + JobNo.ToString() + "&rs%3aCommand=Render&rs%3AFormat=XML";
以下是使用URL進行報告的示例。 它傳遞參數並指定是否應隱藏參數
http://myServer/ReportServer/Pages/ReportViewer.aspx?/InventoryTracking/Receiving/InboundContainerID
&rs:Command=Render&rc:Parameters=false&Plant="20"
如果使用HTML文件來顯示它,那么使用
window.location.href = url;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.