次の方法で共有


Copy メソッド

ServerConnection オブジェクトのコピーを返します。

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

構文

'宣言
Public Function Copy As ServerConnection
'使用
Dim instance As ServerConnection
Dim returnValue As ServerConnection

returnValue = instance.Copy()
public ServerConnection Copy()
public:
ServerConnection^ Copy()
member Copy : unit -> ServerConnection 
public function Copy() : ServerConnection

戻り値

型: Microsoft.SqlServer.Management.Common. . :: . .ServerConnection
参照先 ServerConnection オブジェクトのコピーである ServerConnection オブジェクトです。

使用例

C#

ServerConnection conn = new ServerConnection();
conn.LoginSecure = false;
conn.Login = vlogin;
conn.password = vpassword;
ServerConnection conn2 = conn.Copy()
conn2.StatementTimeout = 450;
Console.WriteLine(conn2.StatementTimeout);
Console.WriteLine(conn.StatementTimeout);

PowerShell

$conn = new-object Microsoft.SqlServer.Management.Common.ServerConnection
$conn.LoginSecure = $FALSE
$conn.Login = vlogin
$conn.Password = vpassword
$conn2 = $conn.Copy()
$conn2.StatementTimeout = 450
Write-Host $conn2.StatementTimeout
Write-Host $conn.StatementTimeout