Aracılığıyla paylaş


url Access'i kullanarak bir Windows uygulamasında

Rapor sunucusu url erişim Web ortamı için optimize edilmiştir, ancak url erişim gömmek için de kullanılabilir Reporting Services içine raporları bir Microsoft Windows uygulama.Ancak, Windows Forms ile ilgilidir url erişim hala Web tarayıcı teknolojisi kullanmanızı gerektirir.url access ve Windows Forms ile aşağıdaki tümleştirme senaryolarına kullanabilirsiniz:

  • Program aracılığıyla bir Web tarayıcısı başlatarak Windows Form'u uygulamadan bir rapor görüntüler.

  • Use WebBrowser denetimi bir Windows formundaki görüntüleme rapor.

Bir Windows formu başlangıç Internet Explorer'dan

Kullanabileceğiniz Process sınıfına erişim işlemi çalışan bir bilgisayar.The Process class is a useful Microsoft .NET Framework construct for starting, stopping, controlling, and monitoring applications.Rapor sunucusu veritabanı içinde belirli bir raporu görüntülemek için siz başlatabilirsiniz IExplore işlemi, url raporu geçirerek.Aşağıdaki kod örneği başlatmak için kullanılan Microsoft Internet Explorer ve geçişi belirli bir rapor url, kullanıcı tıklattığında bir düğmesinde bir Windows formu.

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);
   }
}

Bir rapor sunucusu url erişim belirli sözdizimi hakkında daha fazla bilgi için dize, bkz: url Access sözdizimi.

Bir Windows formundaki bir tarayıcı denetimi katıştırma

Raporunuz dış bir Web tarayıcısında görüntülemek istemiyorsanız, Web tarayıcısı sorunsuz Windows formu kullanarak bir parçası olarak katıştırabilirsiniz WebBrowser Denetim.

WebBrowser denetimi Windows formunuza eklemek için

  1. Create a new Windows application in either Microsoft Visual C# or Microsoft Visual Basic.

  2. Bulun WebBrowser Denetim araç iletişim kutusu.

    If the Toolbox is not visible you can access it by clicking the View menu item and selecting Toolbox.

  3. Drag the WebBrowsercontrol onto the design surface of your Windows Form.

    The WebBrowsercontrol named webBrowser1 is added to the Form

Doğrudan, WebBrowser denetlemek için bir url çağırarak, Kayıt Bul yöntem.Belirli bir url erişim dizesi olarak atamak için WebBrowser çalışma zamanında kontrol saat aşağıdaki örnek. gösterilen

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