5단원: 보고서 정의를 보고서 서버에 게시

보고서 정의를 업데이트하는 마지막 단계는 해당 정의를 다시 보고서 서버에 게시하는 것입니다.

보고서를 보고서 카탈로그에 게시하려면

  • Program.cs 파일(Visual Basic의 경우 Module1.vb)에서 PublishReportDefinition() 메서드의 코드를 다음 코드로 바꿉니다.

    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
    

다음 단원

다음 단원에서는 SampleRDLSchema 응용 프로그램을 컴파일하고 실행합니다. 6단원: RDL Schema 응용 프로그램 실행(VB/C#)을 참조하십시오.