ReportingService2015.GetReportParameters,报告名称参数应包含什么?

时间:2018-10-24 07:06:31

标签: c# asp.net ssrs-2012 reportingservices-2005

我有SSRS报告和订阅。 我想通过用angularJS编写的应用程序中的按钮激活报告。 我发现的第一步是在asp.net中编写c#代码并将其引用到ReportService2005。 我的代码是:

        RS2005.ReportingService2005 rs;
        RE2005.ReportExecutionService rsExec;

        // Create a new proxy to the web service
        rs = new RS2005.ReportingService2005();
        rsExec = new RE2005.ReportExecutionService();

        // Authenticate to the Web service using Windows credentials
        rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
        rsExec.Credentials = System.Net.CredentialCache.DefaultCredentials;

        rs.Url = "http://servername/reportserver/reportservice2005.asmx";
        rsExec.Url = "http://servername/reportserver/reportexecution2005.asmx";

        string historyID = null;
        string deviceInfo = null;
        string format = "PDF";
        Byte[] results;
        string encoding = String.Empty;
        string mimeType = String.Empty;
        string extension = String.Empty;
        RE2005.Warning[] warnings = null;
        string[] streamIDs = null;

        // Path of the Report - XLS, PDF etc.
        //string fileName = @"c:\samplereport.xls";

        string fileName = @"C:\Users\o-tsoudry\Documents\Visual Studio 2015\WebSites\WebSite2\Sites_1.pdf";

        // Name of the report - Please note this is not the RDL file.
        string _reportName = @"h:/Report/Sites_1.pdf";
        //string _reportName = @"/Marketing_Report";
        string _historyID = null;
        bool _forRendering = false;
        RS2005.ParameterValue[] _values = null;
        RS2005.DataSourceCredentials[] _credentials = null;
        RS2005.ReportParameter[] _parameters = null;

        try
        {
            _parameters = rs.GetReportParameters(_reportName, _historyID, _forRendering, _values, _credentials);
            RE2005.ExecutionInfo ei = rsExec.LoadReport(_reportName, historyID);
            RE2005.ParameterValue[] parameters = new RE2005.ParameterValue[1];

            if (_parameters.Length > 0)
            {
                //parameters[0] = new RE2005.ParameterValue();
                //parameters[0].Label = "";
                //parameters[0].Name  = "";
                //parameters[0].Value = "";
            }
            rsExec.SetExecutionParameters(parameters, "en-us");

            results = rsExec.Render(format, deviceInfo,
                      out extension, out encoding,
                      out mimeType, out warnings, out streamIDs);

            using (FileStream stream = File.OpenWrite(fileName))
            {
                stream.Write(results, 0, results.Length);
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }

问题是我得到了错误: The path of the item 'h:/Report/Sites_1.pdf' is not valid. The full path must be less than 260 characters long; other restrictions apply. If the report server is in native mode, the path must start with slash. ---> Microsoft.ReportingServices.Diagnostics.Utilities.InvalidItemPathException: The path of the item 'h:/Report/Sites_1.pdf' is not valid. The full path must be less than 260 characters long; other restrictions apply

我不知道应在ReportingService2015的函数GetReportParameters中的“报告名称”参数中填写哪个路径。

请务必注意,ssrs服务器是我正在使用的另一台服务器。

另外,如果有人可以告诉我如何从用方括号编写的angulaJS中打开ssrs报告,并向该报告发送参数?

谢谢。

0 个答案:

没有答案