ReportingService.CreateDataSource建立資料來源方法

來源:互聯網
上載者:User

using System;

using System.Web.Services.Protocols;

class Sample

{

   public static void Main()

   {

      ReportingService rs = new ReportingService();

      rs.Credentials = System.Net.CredentialCache.DefaultCredentials;

      string name = "AdventureWorks";

      string parent ="/";

      // Define the data source definition.

      DataSourceDefinition definition = new DataSourceDefinition();

      definition.CredentialRetrieval = CredentialRetrievalEnum.Integrated;

      definition.ConnectString = "data source=(local);initial catalog=AdventureWorks";

      definition.Enabled = true;

      definition.EnabledSpecified = true;

      definition.Extension = "SQL";

      definition.ImpersonateUserSpecified = false;

      //Use the default prompt string.

      definition.Prompt = null;

      definition.WindowsCredentials = false;

      try

      {

         rs.CreateDataSource(name, parent, false, definition, null);

      }

      catch (SoapException e)

      {

         Console.WriteLine(e.Detail.InnerXml.ToString());

      }

   }

}

說明:還可以設定parent 為/aaa

-----------------------------------------------------------------------


ConnectString

連接字串 String.

CredentialRetrieval

枚舉值,擷取資料來源的憑證

Prompt:運行該報表的使用者提供的憑據

Store:安全儲存在報表伺服器中的憑據

Integrated:Windows NT 整合式安全性

None:不需要提供憑據

Enabled

資料來源是否可用. Boolean.

EnabledSpecified

顯示指定Enabled屬性值。Boolean

Extension

擴充資料來源: SQL, OLEDB, ODBC, 或自訂擴充. String.

ImpersonateUser

使用者使用嘗試是否使用“安全儲存在報表伺服器中的憑據”建立資料來源. Boolean.

ImpersonateUserSpecified

顯示指定 ImpersonateUser 屬性值.

Password

密碼. String.

Prompt

當需輸入憑據的時候報表伺服器呈現給使用者的提示. String.

UserName

使用者名稱. String.

WindowsCredentials

Windows NT 整合式安全性Boolean.

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.