Lekcja 5: Publikowanie serwer raportów definicja raportu
Ostatnim etapem aktualizacji definicja raportu jest opublikować ją serwer raportów.
Aby opublikować raport wykazu raportu
Zastąp kod PublishReportDefinition() Metoda pliku Program.cs Module1.vb (dla Visual Basic) z następującego kodu:
private void PublishReportDefinition() { System.Console.WriteLine("Publishing Report Definition"); string reportPath = "/AdventureWorks Sample Reports/Company Sales"; XmlSerializer serializer = new XmlSerializer(typeof(Report)); using (MemoryStream stream = new MemoryStream()) { // Serialize the report into the MemoryStream serializer.Serialize(stream, _report); stream.Position = 0; byte[] bytes = stream.GetBuffer(); // Update the report on the report server Warning[] warnings = _reportService.SetReportDefinition(reportPath, bytes); } }
Private Sub PublishReportDefinition() System.Console.WriteLine("Publishing Report Definition") Dim reportPath As String = _ "/AdventureWorks Sample Reports/Company Sales" Dim serializer As XmlSerializer = _ New XmlSerializer(GetType(Report)) Using stream As MemoryStream = New MemoryStream 'Serialize the report into the MemoryStream serializer.Serialize(stream, m_report) stream.Position = 0 'Update the report on the report server Dim bytes As Byte() = stream.GetBuffer Dim warnings As Warning() = _ m_reportService.SetReportDefinition(reportPath, _ bytes) End Using End Sub
Następnej lekcji
W następnej lekcji będzie skompilować i uruchomić SampleRDLSchema aplikacji.Zobacz Lekcja 6: Uruchom aplikację schemat języka RDL (VB / C#).
See Also