日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程语言 > asp.net >内容正文

asp.net

脚本示例 (Reporting Services)Microsoft Visual Basic .NET

發(fā)布時(shí)間:2024/4/17 asp.net 44 豆豆
生活随笔 收集整理的這篇文章主要介紹了 脚本示例 (Reporting Services)Microsoft Visual Basic .NET 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

http://msdn.microsoft.com/zh-cn/library/ms160854(v=sql.90).aspx

腳本示例 (Reporting Services)

SQL Server 2005 此主題尚未評級 - 評價(jià)此主題

以下示例提供了使用 Microsoft Visual Basic .NET 為 Reporting Services 編寫的腳本。腳本示例通常是針對單個功能或技術(shù)問題的,是基于任務(wù)的。您可以使用腳本文件和 Reporting Services SOAP API 進(jìn)行報(bào)表服務(wù)器上的大多數(shù)管理操作。

重要提示:
這些示例僅供教學(xué)使用。這些不是針對生產(chǎn)環(huán)境設(shè)計(jì)的,也沒有在生產(chǎn)環(huán)境中進(jìn)行測試。對于這些示例,Microsoft 不提供相關(guān)的技術(shù)支持。

下表對示例腳本進(jìn)行了說明。

文件說明

AddItemSecurity.rss

示范如何使用腳本在報(bào)表服務(wù)器命名空間中設(shè)置項(xiàng)安全性策略。

CancelRunningJobs.rss

示范一個示例管理腳本,該腳本可取消報(bào)表服務(wù)器上運(yùn)行的作業(yè)。

ConfigureSystemProperties.rss

示范一個可以用來設(shè)置系統(tǒng)級屬性和報(bào)表服務(wù)器屬性的腳本。

PublishSampleReports.rss

示范一個可以將示例報(bào)表發(fā)布到報(bào)表服務(wù)器的腳本。

要求

在運(yùn)行示例腳本之前,必須要滿足以下條件:

  • 必須使用 Reporting Services 安裝程序或單獨(dú)的示例安裝程序,先將示例報(bào)表和腳本文件安裝到硬盤上。
  • 您必須擁有在安裝了報(bào)表服務(wù)器實(shí)例的計(jì)算機(jī)上運(yùn)行 rs 實(shí)用工具的權(quán)限。
  • 您必須擁有報(bào)表服務(wù)器的訪問權(quán)限,才能使用腳本對它進(jìn)行訪問。
  • 您必須對要訪問的報(bào)表服務(wù)器的根文件夾具有相應(yīng)的權(quán)限。有關(guān)權(quán)限和用戶角色的詳細(xì)信息,請參閱管理 Reporting Services 的權(quán)限和安全性。
腳本文件的位置

將示例安裝到默認(rèn)安裝目錄時(shí),默認(rèn)情況下,腳本示例位于 C:\Program Files\Microsoft SQL Server\90\Samples\Reporting Services\Script Samples。

注意:
如果尚未安裝示例,請參閱安裝示例。

運(yùn)行示例腳本

您可以在 Reporting Services 腳本環(huán)境中運(yùn)行示例腳本。

運(yùn)行此示例
  • Open a command prompt: On the Start menu, click Run, type cmd in the text box, and then click OK.

  • 導(dǎo)航到包含示例腳本的目錄。例如,如果示例腳本安裝在默認(rèn)目錄中,請?jiān)诿钐崾痉骆I入以下內(nèi)容:

    復(fù)制 cd C:\Program Files\Microsoft SQL Server\90\Samples\Reporting Services\Script Samples
  • 在命令提示符下,輸入以下內(nèi)容,以查看 rs 實(shí)用工具的可用命令提示選項(xiàng)列表:

    復(fù)制 rs -? 注意:
    如果收到消息,通知您 rs 不是已知命令或批處理文件,則需要將 rs.exe 的位置添加到 Windows 環(huán)境變量 PATH 中。

  • 在命令提示符下,鍵入相應(yīng)的命令以運(yùn)行該示例腳本文件。例如,將給定的服務(wù)器 URL 替換為所訪問的報(bào)表服務(wù)器時(shí),若要運(yùn)行 PublishSampleReports.rss,請鍵入以下命令:

    復(fù)制 rs -i PublishSampleReports.rss -s http://myserver/reportserver
  • 修改腳本文件

    您可以使用文本編輯器打開所有 .rss 文件。

    請參閱

    任務(wù)

    編譯和運(yùn)行代碼示例
    SQL Server Reporting Services 示例

    其他資源

    Scripting with the rs Utility and the Web Service
    應(yīng)用程序示例 (Reporting Services)
    Accessing the SOAP API

    幫助和信息

    獲取 SQL Server 2005 幫助

    ?

    =========

    '============================================================================= ' File: PublishSampleReports.rss ' ' Summary: Demonstrates a script that can be used with RS.exe to ' publish the sample reports that ship with Reporting Services. ' '--------------------------------------------------------------------- ' This file is part of Microsoft SQL Server Code Samples. ' ' Copyright (C) Microsoft Corporation. All rights reserved. ' ' This source code is intended only as a supplement to Microsoft ' Development Tools and/or on-line documentation. See these other ' materials for detailed information regarding Microsoft code samples. ' ' THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY ' KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE ' IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A ' PARTICULAR PURPOSE. '============================================================================= ' ' 1.0 Documentation ' ' Read the following in order to familiarize yourself with the sample script. ' ' 1.1 Overview ' ' This sample script uses a script file (.rss) and the script environment to run ' Web service operations on a specified report server. The script creates a folder ' that you specify as a command-prompt variable using the 杤 switch, and then ' publishes the sample reports that ship with Reporting Services to a report server. ' Depending on the location of your sample reports, you may need to modify the ' value of the filePath variable, which references the path to your sample reports. ' ' 1.2 Script Variables ' ' Variables that are passed on the command line with the -v switch: ' ' (a) parentFolder - corresponds to the folder that the script creates and uses ' to contain your published reports ' ' 1.3 Sample Command Lines ' ' ' 1.3.1 Use the script to publish the sample reports to an AdventureWorks Sample Reports folder. ' ' rs -i PublishSampleReports.rss -s http://myserver/reportserver 'Dim definition As [Byte]() = Nothing Dim warnings As Warning() = Nothing Dim parentFolder As String = "AdventureWorks Sample Reports" Dim parentPath As String = "/" + parentFolder Dim filePath As String = "C:\Program Files\Microsoft SQL Server\100\Samples\Reporting Services\Report Samples\AdventureWorks Sample Reports\"Public Sub Main()rs.Credentials = System.Net.CredentialCache.DefaultCredentials'Create the parent folderTryrs.CreateFolder(parentFolder, "/", Nothing)Console.WriteLine("Parent folder {0} created successfully", parentFolder)Catch e As ExceptionConsole.WriteLine(e.Message)End Try'Create the AdventureWorks shared data sourceCreateSampleDataSource("AdventureWorks", "SQL", "data source=(local);initial catalog=AdventureWorks")CreateSampleDataSource("AdventureWorksDW", "OLEDB-MD", _"data source=localhost;initial catalog=Adventure Works DW")'Publish the sample reportsPublishReport("Company Sales")PublishReport("Employee Sales Summary")PublishReport("Product Catalog")PublishReport("Product Line Sales")PublishReport("Sales Order Detail")PublishReport("Territory Sales Drilldown")End SubPublic Sub CreateSampleDataSource(name As String, extension As String, connectionString As String)'Define the data source definition.Dim definition As New DataSourceDefinition()definition.CredentialRetrieval = CredentialRetrievalEnum.Integrateddefinition.ConnectString = connectionStringdefinition.Enabled = Truedefinition.EnabledSpecified = Truedefinition.Extension = extensiondefinition.ImpersonateUser = Falsedefinition.ImpersonateUserSpecified = True'Use the default prompt string.definition.Prompt = Nothingdefinition.WindowsCredentials = FalseTryrs.CreateDataSource(name, parentPath, False, definition, Nothing)Console.WriteLine("Data source {0} created successfully", name)Catch e As ExceptionConsole.WriteLine(e.Message) End TryEnd Sub Public Sub PublishReport(ByVal reportName As String)TryDim stream As FileStream = File.OpenRead(filePath + reportName + ".rdl")definition = New [Byte](stream.Length) {}stream.Read(definition, 0, CInt(stream.Length))stream.Close()Catch e As IOExceptionConsole.WriteLine(e.Message)End TryTrywarnings = rs.CreateReport(reportName, parentPath, False, definition, Nothing)If Not (warnings Is Nothing) ThenDim warning As WarningFor Each warning In warningsConsole.WriteLine(warning.Message)Next warningElseConsole.WriteLine("Report: {0} published successfully with no warnings", reportName)End IfCatch e As ExceptionConsole.WriteLine(e.Message)End Try End Sub

    ?

    總結(jié)

    以上是生活随笔為你收集整理的脚本示例 (Reporting Services)Microsoft Visual Basic .NET的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。