4단원: 프로그래밍 방식으로 보고서 정의 업데이트

새 설치: 2006년 7월 17일

이제 보고서 서버에서 보고서 정의가 로드되었고 보고서 필드를 사용하여 해당 정의를 참조했으므로 보고서 정의를 업데이트해야 합니다. 이 예에서는 보고서의 Description 속성을 업데이트합니다.

보고서 정의를 업데이트하려면

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

    private void UpdateReportDefinition()
    {
        System.Console.WriteLine("Updating Report Definition");
    
        // Create a list of the Items Choices for the Report. The 
        // ItemsChoiceType37 enum represents all the properties
        // available in the report and the ItemsElementName 
        // represents the properties that exist in the current 
        // instance of the report.
        List<ItemsChoiceType37> _reportItems = 
            new List<ItemsChoiceType37>(_report.ItemsElementName);
    
        // Locate the index for the Description property
        int index = _reportItems.IndexOf(
            ItemsChoiceType37.Description);
    
        System.Console.WriteLine("- Old Description: " + 
                                 _report.Items[index]);
    
        // Update the Description for the Report
        _report.Items[index] = "New Report Description";
    
        System.Console.WriteLine("- New Description: " + 
                                 _report.Items[index]);
    }
    
    Private Sub UpdateReportDefinition()
    
        System.Console.WriteLine("Updating Report Definition")
    
        'Create a list of the Items Choices for the Report. The 
        'ItemsChoiceType37 enum represents all the properties
        'available in the report and the ItemsElementName 
        'represents the properties that exist in the current 
        'instance of the report.
        Dim reportItems As List(Of ItemsChoiceType37) = _
            New List(Of ItemsChoiceType37)(m_report.ItemsElementName)
    
        'Locate the index for the Description property
        Dim index As Integer = _
            reportItems.IndexOf(ItemsChoiceType37.Description)
    
        System.Console.WriteLine("- Old Description: " & _
                                 m_report.Items(index))
    
        'Update the Description for the Report
        m_report.Items(index) = "New Report Description"
    
        System.Console.WriteLine("- New Description: " & _
                                 m_report.Items(index))
    
    End Sub
    

다음 단원

다음 단원에서는 업데이트된 보고서 정의를 다시 보고서 서버에 저장합니다. 5단원: 보고서 정의를 보고서 서버에 게시을 참조하십시오.

참고 항목

작업

자습서: RDL 스키마에서 생성한 클래스를 사용하여 보고서 업데이트

관련 자료

Report Definition Language

도움말 및 정보

SQL Server 2005 지원 받기