UserName プロパティ

Windows 認証を使用しない場合、接続のユーザー名を取得します。値の設定も可能です。

名前空間:  Microsoft.SqlServer.Dts.ManagedConnections
アセンブリ:  Microsoft.SqlServer.ManagedConnections (Microsoft.SqlServer.ManagedConnections.dll)

構文

'宣言
Public Property UserName As String
    Get
    Set
'使用
Dim instance As WMIConn
Dim value As String

value = instance.UserName

instance.UserName = value
public string UserName { get; set; }
public:
property String^ UserName {
    String^ get ();
    void set (String^ value);
}
member UserName : string with get, set
function get UserName () : String
function set UserName (value : String)

プロパティ値

型: System. . :: . .String
接続のユーザー名を表す String です。

説明

Windows 認証を使用しない場合、接続のユーザー名とパスワードを指定する必要があります。

使用例

次のコード例では、パッケージに WMI 接続を追加し、ServerName プロパティ、UserName プロパティ、および Password プロパティを設定します。コード例は、アプリケーションに応じた適切な値がプロパティに設定されるように変更する必要があります。

ConnectionManager WmiConn = pkg.Connections.Add("WMI");
DtsProperty prop = WmiConn.Properties["ServerName"];
prop.SetValue(WmiConn, @"\\localhost");
WmiConn.Properties["Username"].SetValue(WmiConn, @"");
WmiConn.Properties["Password"].SetValue(WmiConn, @"");
Dim WmiConn As ConnectionManager =  pkg.Connections.Add("WMI") 
Dim prop As DtsProperty =  WmiConn.Properties("ServerName") 
prop.SetValue(WmiConn, "\\localhost")
WmiConn.Properties("Username").SetValue(WmiConn, @"")
WmiConn.Properties("Password").SetValue(WmiConn, @"")