語言

WMIConn.UserName 屬性

定義

如果你沒有使用 Windows 驗證,它會取得或設定連線的使用者名稱。

public:
 property System::String ^ UserName { System::String ^ get(); void set(System::String ^ value); };
public string UserName { get; set; }
member this.UserName : string with get, set
Public Property UserName As String

屬性值

一個包含該連線使用者名稱的字串。

範例

以下程式碼範例為套件新增 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, @"")  

備註

如果你沒有使用 Windows 認證,必須提供連線的使用者名稱和密碼。

適用於