Share via


LoginSecure プロパティ

サーバーへの接続時に Windows 認証を使用するか、SQL Server 認証を使用するかを示す Boolean プロパティを取得または設定します。

名前空間:  Microsoft.SqlServer.Management.Common
アセンブリ:  Microsoft.SqlServer.ConnectionInfo (Microsoft.SqlServer.ConnectionInfo.dll)

構文

'宣言
Public Property LoginSecure As Boolean
    Get
    Set
'使用
Dim instance As ConnectionSettings
Dim value As Boolean

value = instance.LoginSecure

instance.LoginSecure = value
public bool LoginSecure { get; set; }
public:
property bool LoginSecure {
    bool get ();
    void set (bool value);
}
member LoginSecure : bool with get, set
function get LoginSecure () : boolean
function set LoginSecure (value : boolean)

プロパティ値

型: System. . :: . .Boolean
サーバーへの接続が Windows 認証または SQL Server 認証のどちらを使用して確立されるかを示す Boolean 値です。
True (既定値) の場合、Windows 認証を使用してサーバーとの接続が確立されます。
False の場合、SQL Server 認証を使用してサーバーとの接続が確立されます。

使用例

'Declare a ServerConnection object variable to specify SQL authentication, login and password.
Dim conn As New ServerConnection
conn.LoginSecure = False
conn.Login = vlogin
conn.Password = vpassword
'Connect to the local, default instance of SQL Server.
Dim srv As Server
srv = New Server(conn)
'The actual connection is made when a property is retrieved.
Console.WriteLine(srv.Information.Version)
'The connection is automatically disconnected when the Server variable goes out of scope.