ServerConnection.Copy Method

Returns a copy of the ServerConnection object.

命名空间: Microsoft.SqlServer.Management.Common
程序集: Microsoft.SqlServer.ConnectionInfo (in microsoft.sqlserver.connectioninfo.dll)

语法

声明
Public Function Copy As ServerConnection
public ServerConnection Copy ()
public:
ServerConnection^ Copy ()
public ServerConnection Copy ()
public function Copy () : ServerConnection

返回值

A ServerConnection object that is a copy of the referenced ServerConnection object.

备注

仅 Microsoft .NET Framework 的 2.0 版本支持此命名空间、类或成员。

示例

'Connect to the local, default instance of SQL Server.
Dim srv1 As Server
srv1 = New Server()
'Modify the default database and the timeout period for the connection.
srv1.ConnectionContext.DatabaseName = "AdventureWorks"
srv1.ConnectionContext.ConnectTimeout = 30
'Make a second connection using a copy of the ConnectionContext property and verify settings.
Dim srv2 As Server
srv2 = New Server(srv1.ConnectionContext.Copy)
Console.WriteLine(srv2.ConnectionContext.ConnectTimeout.ToString)

线程安全

Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

平台

开发平台

有关支持的平台列表,请参阅安装 SQL Server 2005 的硬件和软件要求。

目标平台

有关支持的平台列表,请参阅安装 SQL Server 2005 的硬件和软件要求。

请参阅

参考

ServerConnection Class
ServerConnection Members
Microsoft.SqlServer.Management.Common Namespace

其他资源

How to: Copy an SMO Object in Visual Basic .NET
Calling Methods