LinkedServers 屬性
表示 LinkedServer 物件的集合。每個 LinkedServer 物件表示 SQL Server 執行個體上已註冊的連結伺服器。
命名空間: Microsoft.SqlServer.Management.Smo
組件: Microsoft.SqlServer.Smo (在 Microsoft.SqlServer.Smo.dll 中)
語法
'宣告
<SfcObjectAttribute(SfcContainerRelationship.ObjectContainer, SfcContainerCardinality.ZeroToAny, _
GetType(LinkedServer))> _
Public ReadOnly Property LinkedServers As LinkedServerCollection
Get
'用途
Dim instance As Server
Dim value As LinkedServerCollection
value = instance.LinkedServers
[SfcObjectAttribute(SfcContainerRelationship.ObjectContainer, SfcContainerCardinality.ZeroToAny,
typeof(LinkedServer))]
public LinkedServerCollection LinkedServers { get; }
[SfcObjectAttribute(SfcContainerRelationship::ObjectContainer, SfcContainerCardinality::ZeroToAny,
typeof(LinkedServer))]
public:
property LinkedServerCollection^ LinkedServers {
LinkedServerCollection^ get ();
}
[<SfcObjectAttribute(SfcContainerRelationship.ObjectContainer, SfcContainerCardinality.ZeroToAny,
typeof(LinkedServer))>]
member LinkedServers : LinkedServerCollection
function get LinkedServers () : LinkedServerCollection
屬性值
型別:Microsoft.SqlServer.Management.Smo. . :: . .LinkedServerCollection
LinkedServerCollection 物件,表示 SQL Server 執行個體上已註冊的所有連結伺服器。
備註
The LinkedServers property points to the LinkedServerCollection object. You can use the collection to reference the linked servers registered on the instance of SQL Server.
範例
Visual Basic
'Connect to the local, default instance of SQL Server.
Dim srv As Server
srv = New Server
'Display the linked servers.
Dim lksv As LinkedServer
For Each lksv In srv.LinkedServers
Console.WriteLine(lksv.Name)
Next
PowerShell
$srv = new-object Microsoft.SqlServer.Management.Smo.Server("(local)")
foreach ($lksv in $srv.LinkedServers)
{
Write-Host $lksv.Name
}