次の方法で共有


レッスン 5: レポート定義をレポート サーバーにパブリッシュする

レポート定義を更新する最後の手順は、レポート サーバーにレポート定義を発行することです。

レポート カタログにレポートを発行するには

  1. Program.cs ファイル内の PublishReportDefinition() メソッドのコード (Visual Basic の場合Module1.vb) を次のコードに置き換えます。

    private void PublishReportDefinition()  
    {  
        System.Console.WriteLine("Publishing Report Definition");  
    
        string reportPath =  
            "/AdventureWorks 2012 Sample Reports/Company Sales 2012";  
    
        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 2012 Sample Reports/Company Sales 2012"  
        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 スキーマ アプリケーションの実行 (VB-C#) を参照してください。

こちらもご覧ください

RDL スキーマから生成されたクラスを使用したレポートの更新 (SSRS チュートリアル)
レポート定義言語 (SSRS)