文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Removing reports / report folder by SSRS (SQL SERVER REPORTING SERVICE)

Removing reports / report folder by SSRS (SQL SERVER REPORTING SERVICE)

时间:2010-12-15  来源:zencorn

1.       Create a C# console application project.

2.       Add one web reference into the project.

 

3.       Open the “Web References/WebServicelocalhost” folder from the project location directory and find out the “Reference.cs” file in there.

4.       Create a new console project then add the “References. cs” as a class file,   add the web reference project as a reference.

 

5.       Open the web reference project and change the internal keyword to public in the file of “Settings.Designer.cs”.

public sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {

6.       Open the “Reference.cs” file and change the namespace to a new definitely one.

 //WebServicelocalhost

namespace TempWebRef.LocalReportServiceRemoveGenReport { ...

7.       Create a static private method in the “Reference.cs “ class ,it is will be better write around the “DeleteItem” default method.

 

代码
8.    public void DeleteItem(string Item) {
9.                this.Invoke("DeleteItem", new object[] {
10.                            Item});
11.            }
12.    
13.            public static string DeleteReport(string _reportPath, string _reportServerURL)
14.            {
15.                string strReturn;
16.                strReturn = "success";
17.                try
18.                {
19.                    ReportingService2005 rs = new ReportingService2005();  // Declare one reference object .
20.                    _reportPath = "/GenevaReports/13Report"; // Naming the report path you want to remove. And if you want to remove a folder , only change the path as the main folder name like ‘/GenevaReports’
21.                    _reportServerURL = "http://" + _reportServerURL + "/reportserver/ReportService2005.asmx"; // Create the report server URL string which the reports belong to.
22.    
23.                    rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
24.                    rs.Url = _reportServerURL;
25.    
26.    
27.                    rs.DeleteItem(_reportPath); // Call the execution.
28.    
29.                    return strReturn;
30.                }
31.                catch (Exception xe)
32.                {
33.    
34.                    strReturn = xe.Message + _reportServerURL;
35.                    return strReturn;
36.                }
37.    

 

8.  Switch to another project and call the report deleting method like below.

string stemp = TempWebRef.LocalReportServiceRemoveGenReport.ReportingService2005.DeleteReport("TestReport","Server3");

 

 

 

 

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载