URL 액세스를 사용하여 Reporting Services 통합 - Windows 애플리케이션

보고서 서버에 대한 URL 액세스는 웹 환경에 최적화되어 있지만 URL 액세스를 사용하여 Reporting Services 보고서를 Microsoft Windows 애플리케이션에 포함할 수도 있습니다. 그러나 Windows Forms와 관련된 URL 액세스는 여전히 웹 브라우저 기술을 사용해야 합니다. URL 액세스 및 Windows Forms와 함께 다음 통합 시나리오를 사용할 수 있습니다.

  • 프로그래밍 방식으로 웹 브라우저를 시작하여 Windows Form 애플리케이션의 보고서를 표시합니다.

  • Windows Form의 WebBrowser 컨트롤을 사용하여 보고서를 표시합니다.

Windows Form에서 Internet Explorer 시작

클래스를 Process 사용하여 컴퓨터에서 실행 중인 프로세스에 액세스할 수 있습니다. 이 Process 클래스는 애플리케이션 시작, 중지, 제어 및 모니터링을 위한 유용한 Microsoft .NET Framework 구문입니다. 보고서 서버 데이터베이스의 특정 보고서를 보려면 IExplore 프로세스를 시작하여 보고서에 대한 URL을 전달합니다. 다음 코드 예제를 사용하여 Microsoft Internet Explorer를 시작하고 사용자가 Windows Form에서 단추를 선택할 때 특정 보고서 URL을 전달할 수 있습니다.

Private Sub viewReportButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles viewReportButton.Click  
   ' Build the URL access string based on values supplied by a user  
   Dim url As String = serverUrlTextBox.Text + "?" & reportPathTextBox.Text & _  
   "&rs:Command=Render" & "&rs:Format=HTML4.0"  
  
   ' If the user does not select the toolbar check box,  
   ' turn the toolbar off in the HTML Viewer  
   If toolbarCheckBox.Checked = False Then  
      url += "&rc:Toolbar=False"  
   End If  
   ' load report in the Web browser  
   Try  
      System.Diagnostics.Process.Start("IExplore", url)  
   Catch  
      MessageBox.Show("The system could not start the specified report using Internet Explorer.", _  
      "An error has occurred", MessageBoxButtons.OK, MessageBoxIcon.Error)  
   End Try  
End Sub 'viewReportButton_Click  
// Sample click event for a Button control on a Windows Form  
private void viewReportButton_Click(object sender, System.EventArgs e)  
{  
   // Build the URL access string based on values supplied by a user  
   string url = serverUrlTextBox.Text + "?" + reportPathTextBox.Text +  
      "&rs:Command=Render" + "&rs:Format=HTML4.0";  
  
   // If the user does not check the toolbar check box,  
   // turn the toolbar off in the HTML Viewer  
   if (toolbarCheckBox.Checked == false)  
      url += "&rc:Toolbar=False";  
  
   // load report in the Web browser  
   try  
   {  
      System.Diagnostics.Process.Start("IExplore", url);  
   }  
  
   catch (Exception)  
   {  
      MessageBox.Show(  
         "The system could not open the specified report using Internet Explorer.",   
         "An error has occurred", MessageBoxButtons.OK, MessageBoxIcon.Error);  
   }  
}  

Windows Form에 브라우저 컨트롤 포함

외부 웹 브라우저에서 보고서를 보지 않으려면 컨트롤을 사용하여 WebBrowser 웹 브라우저를 Windows Form의 일부로 원활하게 포함할 수 있습니다.

Windows Form에 WebBrowser 컨트롤을 추가하려면
  1. Microsoft C# 또는 Microsoft Visual Basic에서 새 Windows 애플리케이션을 만듭니다.

  2. WebBrowser 도구 상자 대화 상자에서 컨트롤을 찾습니다.

    도구 상자표시되지 않으면 보기 메뉴 항목을 선택하고 도구 상자를 선택하여 액세스할 수 있습니다.

  3. 컨트롤을 WebBrowserWindows Form의 디자인 화면으로 끌어다 놓습니다.

    이름이 webBrowser1인 WebBrowser 컨트롤이 폼에 추가됩니다.

Navigate 메서드를 WebBrowser 호출하여 컨트롤을 URL로 전달합니다. 다음 예제와 같이 런타임에 컨트롤에 WebBrowser 특정 URL 액세스 문자열을 할당할 수 있습니다.

Dim url As String = "https://localhost/reportserver?/" & _  
                    "AdventureWorks Sample Reports/" & _  
                    "Company Sales&rs:Command=Render"  
WebBrowser1.Navigate(url)  
string url = "https://localhost/reportserver?/" +  
             "AdventureWorks Sample Reports/" +  
             "Company Sales&rs:Command=Render";  
webBrowser1.Navigate(url);  

애플리케이션에 Reporting Services 통합
URL 액세스를 사용하여 Reporting Services 통합
SOAP를 사용하여 Reporting Services 통합
ReportViewer 컨트롤을 사용하여 Reporting Services 통합
URL 액세스(SSRS)