SSRS не для dba

Post on 19-Jul-2015

85 views 2 download

transcript

sql server reporting servicesГеоргий Григорьев

Первая версия

Результат работы приложения

SELECT w.FullName ,w.Position ,r.TestDate ,SUM(r.IsCorrectAnswer)/COUNT(r.ResultId) AS [Score]FROM Results r INNER JOIN Workers w ON w.WorkerId = r.WorkerIdWHERE r.TestDate>DATEADD(MONTH ,-1 ,GETDATE())GROUP BY w.WorkerId ,w.FullName ,w.Position ,r.TestDate

Результат работы приложения

Report Builder

Report Builder

Report Builder

Report Builder

Visual Studio

SQL Server Data Tools

Visual Studio

rdl отчеты

Visual Studio

Хранение отчетов

User-friendly отчеты

● ReportExecutionService○ http://ReportingServiceURL/ReportServer/ReportExecution2005.asmx?wsdl

● ReportService2010○ http://ReportingServiceURL/ReportServer/ReportService2010.asmx?wsdl

SOAP сервисы SSRS

SOAP сервисы SSRS

Soap api reporting service’аusing (var rsClient = new ReportExecutionServiceSoapClient("ReportExecutionServiceSoap")) { rsClient.ClientCredentials.Windows.ClientCredential = CreateClientCredential(); rsClient.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation; rsClient.ClientCredentials.Windows.AllowNtlm = true; string reportPath = "/" + SERVER_REPORTS_FOLDER + "/" + config.ReportServerName; string format = config.ExportFileType.ToString();#region ssrs standart variables FileStream stream = null; string fileName, filePath; try { execHeader = rsClient.LoadReport(trustedUh, reportPath, historyID, out serverInfo, out execInfo); rsClient.SetExecutionParameters(execHeader, trustedUh, parameters, locale, out execInfo); byte[] result; rsClient.Render(execHeader, trustedUh, format, devInfo, out result, out extension, out encoding, out mimeType, out warnings, out streamIDs); fileName = config.ReportFileName + "." + extension; var exportdirectory = FilesDirectoryHelper.GetExportDirectoryPath(config.ExportDirectory); filePath = Path.Combine(exportdirectory, fileName); stream = File.OpenWrite(filePath); stream.Write(result, 0, result.Length); } catch (Exception e) { logger.LogException(@"Во время экспорта отчета """ + config.ReportFileName + @""" возникла ошибка", e); fileName = null; } finally { string message= @"Завершена выгрузка файла """ + config.ReportFileName + @""", файл сохранен под именем " + fileName + @"."; logger.Log(LogEventType.Info, message); if(stream == null) ?? stream.Close(); } return filePath; }

Soap api reporting service’а#region ssrs standart variables string devInfo = @"<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>"; string historyID , encoding, mimeType, extension; Warning[] warnings; string[] streamIDs; string locale = "ru-RU"; var execInfo = new ExecutionInfo(); var trustedUh = new TrustedUserHeader(); var execHeader = new ExecutionHeader(); var serverInfo = new ServerInfoHeader();#endregion

var config = new ReportConfiguration();config.ReportServerName = reportName;config.ReportFileName = fileName;config.ExportFileType = type;config.ExportDirectory = filesDirectory;

string user = ConfigurationManager.AppSettings["SSRSUser"];string password = ConfigurationManager.AppSettings["SSRSPassword"];string domain = ConfigurationManager.AppSettings["SSRSDomain"];var cred = new NetworkCredential(user, password, domain);return cred;

Подписки

Подписки

ReportViewer

ReportViewer

Сравнение версийExpress Workgroup Standard Enterprise

Data sources Local SQL Server instance SQL Server and Analysis Services Да

Rendering formats Excel, PDF, Image (RGDI, Print), HTML, Word Да

Management Report ManagerSupports SQL Server

Management Studio, Report Manager

Да

Caching, History, Delivery, Scheduling Нет Да

Extensibility Нет

Можно добавлять/удалять свои

источники данных, рендеры, и средства

распространения

Да

Custom authentication Нет ДаScale-out Report Servers Нет Да

Subscriptions Нет ДаData-driven subscriptions Нет Да

Role-based security Поддерживается, но роли изменять нельзя

Поддерживается, но роли изменять нельзя

Поддерживается, можно добавить свои роли Да

Report bulider Нет ДаReport models Нет Да

Model-level security Нет ДаInfinite clickthrough Нет Да

● Формирование и доставка статистических и административных отчетов.

● Формирование отчетов о результатах работы приложения.● Встраивание отчета в ваше приложение.● Генерация статичного html контента.

Применение SSRS

?Вопросы

https://ru.linkedin.com/in/georgygrigoryev

https://www.facebook.com/iamkarlson

http://iamkarlson.tk/

Контакты