加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – ReportingServices SetReportDataSources您正在尝试项错误

发布时间:2020-12-16 01:48:13 所属栏目:百科 来源:网络整理
导读:我只是想设置一个共享数据源. 我一直得到例外 The operation you are attempting on item is not allowed for this item type. 也许我有一些混合的东西,但我无法确定它. filepath = / Base / Vendor(报告的完整路径); datasource = IBBase public static voi
我只是想设置一个共享数据源.
我一直得到例外

The operation you are attempting on item is not allowed for this item type.

也许我有一些混合的东西,但我无法确定它.

filepath = / Base / Vendor(报告的完整路径);
datasource = IBBase

public static void UpdateDataSource(string filepath,string datasource)
    {
        ReportingService rs = new ReportingService();
        rs.Credentials = System.Net.CredentialCache.DefaultCredentials;

        ServicesReport.DataSourceReference reference = new ServicesReport.DataSourceReference();
        reference.Reference = filepath;
        ServicesReport.DataSource[] dataSources = new ServicesReport.DataSource[1];
        ServicesReport.DataSource ds = new ServicesReport.DataSource();
        ds.Item = (ServicesReport.DataSourceDefinitionOrReference)reference;
        ds.Name = datasource;
        dataSources[0] = ds;

        try
        {
            rs.SetReportDataSources(filepath,dataSources);
            Console.WriteLine("New reference set for the report.");

        }

        catch (SoapException e) 
        {
            Console.WriteLine(e.Detail.InnerXml.ToString());
        }
    }

解决方法

此Connect调用使用SetItemDataSources方法报告相同的错误代码: http://connect.microsoft.com/SQLServer/feedback/details/318868/ssrs-2005-sp2-setitemdatasource-web-method-bug#details.

微软给出的答案的底线是数据源名称不能是任意的.它必须与当前报告关联的现有匹配.您是否可以检查报表服务器上的报表配置是否与您在代码中尝试连接的EXACT相同的数据源?

如果没有,您找到了可能的问题原因.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读