Server Constructor (ServerConnection)

Initializes a new instance of the Server class based on the specified connection.

命名空間: Microsoft.SqlServer.Management.Smo
組件: Microsoft.SqlServer.Smo (in microsoft.sqlserver.smo.dll)

語法

'宣告
Public Sub New ( _
    serverConnection As ServerConnection _
)
public Server (
    ServerConnection serverConnection
)
public:
Server (
    ServerConnection^ serverConnection
)
public Server (
    ServerConnection serverConnection
)
public function Server (
    serverConnection : ServerConnection
)

參數

  • serverConnection

備註

更新的文字:

只有 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)

平台

開發平台

如需受支援的平台清單,請參閱<安裝 SQL Server 2005 的硬體和軟體需求>。

目標平台

如需受支援的平台清單,請參閱<安裝 SQL Server 2005 的硬體和軟體需求>。

請參閱

參考

Server Class
Server Members
Microsoft.SqlServer.Management.Smo Namespace

其他資源

How to: Copy an SMO Object in Visual Basic .NET
Connecting to an Instance of SQL Server
Disconnecting from an Instance of SQL Server
管理伺服器