Lekcja 5: Publikowanie na serwerze raportów definicji raportu
Ostatnim etapem aktualizacji definicja raportu jest opublikować go serwer raportów.
Aby opublikować raport wykazu raportu
Zastąp kod PublishReportDefinition() metoda w pliku Plik Program.cs (Module1.vb dla Visual Basic) z następującego kodu:
private void PublishReportDefinition() { System.Console.WriteLine("Publishing Report Definition"); string reportPath = "/AdventureWorks 2008 Sample Reports/Company Sales 2008"; 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.ToArray(); // Update the report on the report server Warning[] warnings = _reportService.SetItemDefinition(reportPath, bytes, null); } }
Private Sub PublishReportDefinition() System.Console.WriteLine("Publishing Report Definition") Dim reportPath As String = _ "/AdventureWorks 2008 Sample Reports/Company Sales 2008" 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.ToArray Dim warnings As Warning() = _ m_reportService.SetItemDefinition(reportPath, bytes, Nothing) End Using End Sub
Następnej lekcji
W następnej lekcji będzie skompilować i uruchomić SampleRDLSchema aplikacji.See Lekcja 6: Uruchom aplikację schematów RDL (VB / C#).
Zobacz także