我爱我家

我爱过,所以我不悔;我努力,所以我收获;我宽容,所以我平静;我知足,所以我快乐;我有你,所以我幸福。

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
首先添加web引用
http://server/reportserver/reportservice.asmx
ReportingService rService = new ReportingService();//创建报表服务实例
rService.Credentials = System.Net.CredentialCache.DefaultCredentials;//默认系统凭据
CatalogItem[] catalogItems;
catalogItems = rService.ListChildren("/", true);//对根路径检索
foreach(CatalogItem item in catalogItems)
{
    if(item.Type ==ItemTypeEnum.Folder)
{
//遍历报表文件夹
}
}
 foreach(CatalogItem item in catalogItems)
{
if(item.Type ==ItemTypeEnum.Report)
{
//遍历报表
}
}
//搜索报表
ReportService.SearchCondition[] condition=new SearchCondition[1];
condition[0]=new SearchCondition();
condition[0].Name ="Name";
condition[0].Value =this.TextBox1.Text ;
catalogItems=rs.FindItems ("/",WebReportSample.ReportService .BooleanOperatorEnum .And ,condition);
//发布报表
byte[] reportData;
System.IO .FileStream fs=System.IO .File.OpenRead ("c:\\Report1.rdl");
reportData=new byte [fs.Length ];
fs.Read (reportData,0,fs.Length );
rs.CreateReport ("New Report","/",false,reportData,null);
//删除报表
rs.DeleteItem ("报表名称");
posted on 2004-07-29 17:28  白水书生  阅读(748)  评论(0编辑  收藏  举报