共用方式為


Package.LoadUserCertificateByName Method

Loads the certificate for the package according to the certificate name.

命名空間: Microsoft.SqlServer.Dts.Runtime
組件: Microsoft.SqlServer.ManagedDTS (in microsoft.sqlserver.manageddts.dll)

語法

'宣告
Public Sub LoadUserCertificateByName ( _
    subjectName As String _
)
public void LoadUserCertificateByName (
    string subjectName
)
public:
void LoadUserCertificateByName (
    String^ subjectName
)
public void LoadUserCertificateByName (
    String subjectName
)
public function LoadUserCertificateByName (
    subjectName : String
)

參數

  • subjectName
    The name of the certificate for the package.

範例

The following code example shows the syntax to load a user certificate using the name.

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Dts.Runtime;

namespace Package_API
{
    class Program
    {
        static void Main(string[] args)
        {
            Application app = new Application();
            Package pkg = new Package();

            pkg.Name = ("Cool Test on Loading Certificates");
            pkg.LoadUserCertificateByName("\"VeriSign, Inc.\", VeriSign Trust Network, \"www.verisign.com/repository/RPA Incorp. by Ref.,LIAB.LTD(c)98\", Persona Not Validated, Digital ID Class 1 - Microsoft, <name>, <alias>");
        
    pkg.LoadUserCertificateByHash(pkg.CertificateObject.GetCertHash());

            // Save signed package  to change_this.dtsx
            app.SaveToXml("change_this.dtxs", pkg, null);
            app.CheckSignatureOnLoad = false;
            pkg = app.LoadPackage("change_this.dtxs", null);
            DTSSignatureStatus dss = pkg.CheckSignature();
        }
    }
}
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.SqlServer.Dts.Runtime

Class Program
    Shared Sub Main(ByVal args() As String)
        Dim app As New Application()
        Dim pkg As New Package()

        pkg.Name = "Cool Test on Loading Certificates"
        pkg.LoadUserCertificateByName("""VeriSign, Inc."", VeriSign Trust Network, ""www.verisign.com/repository/RPA Incorp. by Ref.,LIAB.LTD(c)98"", Persona Not Validated, Digital ID Class 1 - Microsoft, <name>, <alias>")
        pkg.LoadUserCertificateByHash(pkg.CertificateObject.GetCertHash())

        ' Save signed package  to change_this.dtsx
        app.SaveToXml("change_this.dtxs", pkg, Nothing)
        app.CheckSignatureOnLoad = False
        pkg = app.LoadPackage("change_this.dtxs", Nothing)
        Dim dss As DTSSignatureStatus = pkg.CheckSignature()
    End Sub
End Class

執行緒安全性

Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

平台

開發平台

如需受支援的平台清單,請參閱<安裝 SQL Server 2005 的硬體和軟體需求>。

目標平台

如需受支援的平台清單,請參閱<安裝 SQL Server 2005 的硬體和軟體需求>。

請參閱

參考

Package Class
Package Members
Microsoft.SqlServer.Dts.Runtime Namespace