ReportingService2015.GetReportParameters, что должно быть в параметре имени отчета? - PullRequest
0 голосов
/ 24 октября 2018

У меня есть отчет SSRS и подписки.И я хочу активировать отчет кнопкой в ​​моем приложении, написанном на angularJS.Я обнаружил, что первым шагом является написание кода на c # в asp.net и ссылка на него в 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.

Я не понимаю, какой путь я должен заполнить в параметре Имя отчета в функции GetReportParametersof ReportingService2015.

Важно отметить, что сервер ssrs является еще одним сервером, над которым я работаю.

Кроме того, если кто-то может сказать мне, как я открываю отчет ssrs из моегоangulaJS, что написали в скобках и отправили параметры в отчет?

Спасибо.

...