Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

ServerConnection.Copy Method

Returns a copy of the ServerConnection object.

Namespace:  Microsoft.SqlServer.Management.Common
Assembly:  Microsoft.SqlServer.ConnectionInfo (in Microsoft.SqlServer.ConnectionInfo.dll)
public ServerConnection Copy()

Return Value

Type: Microsoft.SqlServer.Management.Common.ServerConnection
A ServerConnection object that is a copy of the referenced ServerConnection object.

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
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.