通過url訪問Reporting Service中的報表

 

Reporting Service允許使用url傳遞相關參數,並打開報表,我試驗了一下,可以通過多種rul方式訪問這些報表,我現在常用的有兩種:

第一種,我是通過查看最終報表屬性中的鏈接推算出來的:

public string GetReportUrl(string strUserID,string BeginDate,string EndDate,string strFolderRoot,string strFolder1,string ReportName )

{

Reports myRp =new Reports();

string strUrl="";

strFolderRoot=myRp.StrToHex(strFolderRoot);

strFolder1=myRp.StrToHex(strFolder1);

ReportName=myRp.StrToHex(ReportName);

//服務器的名稱/reportserver

strUrl=@"http://oareport.test.net/ReportServer?%2f"+strFolderRoot+"%2f"+strFolder1+"%2f"+ReportName+"&";

strUrl=strUrl+"BeginDate="+BeginDate+"&EndDate="+EndDate+

"&UserID="+strUserID+

"&rs%3aClearSession=true&rs%3aCommand=Render&rs%3aFormat=HTML4.0"+

"&rc%3aReplacementRoot=http%3a%2f%2f"+

"oareport.hollysys.net%2fReports%2fPages%2fReport.aspx%3fServerUrl%3d&rc%3a"+

"Toolbar=True&rc%3aJavaScript=True&rc%3aLinkTarget=_blank&rc%3aArea=Report";

return strUrl;

 

}

 

另一種是reporting Service 幫助文件中的標準用法:

http://server/virtualroot?[/pathinfo]&prefix:param=value[&prefix:param=value]...n]

而且它還可以根據需要定製頁面的格式等,詳細情況幫助文件說的很明白,要用的時候參考一下那個就好了。

不過這裏要注意,reporting Service 中的url中的漢字必須轉換成utf編碼纔行,因此我的例子中用了StrToHex()這個函數,詳細地內容可以參考我的另一篇文章。

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章