Condividi tramite


Proprietà Logins

Rappresenta una raccolta di oggetti Login. Ogni oggetto Login rappresenta un account di accesso definito nell'istanza di SQL Server.

Spazio dei nomi  Microsoft.SqlServer.Management.Smo
Assembly:  Microsoft.SqlServer.Smo (in Microsoft.SqlServer.Smo.dll)

Sintassi

'Dichiarazione
<SfcObjectAttribute(SfcContainerRelationship.ObjectContainer, SfcContainerCardinality.ZeroToAny,  _
    GetType(Login))> _
Public ReadOnly Property Logins As LoginCollection
    Get
'Utilizzo
Dim instance As Server
Dim value As LoginCollection

value = instance.Logins
[SfcObjectAttribute(SfcContainerRelationship.ObjectContainer, SfcContainerCardinality.ZeroToAny, 
    typeof(Login))]
public LoginCollection Logins { get; }
[SfcObjectAttribute(SfcContainerRelationship::ObjectContainer, SfcContainerCardinality::ZeroToAny, 
    typeof(Login))]
public:
property LoginCollection^ Logins {
    LoginCollection^ get ();
}
[<SfcObjectAttribute(SfcContainerRelationship.ObjectContainer, SfcContainerCardinality.ZeroToAny, 
    typeof(Login))>]
member Logins : LoginCollection
function get Logins () : LoginCollection

Valore proprietà

Tipo: Microsoft.SqlServer.Management.Smo. . :: . .LoginCollection
Oggetto LoginCollection che rappresenta tutti gli account di accesso definiti nell'istanza di SQL Server.

Osservazioni

The Logins property points to the LoginCollection object. The collection can be used to enumerate all the logins for the instance of SQL Server. If you are using Windows Authentication only, the Logins property represents Windows-authenticated accounts. With Mixed Mode Authentication, this property also represents accounts that are created by using SQL Server Authentication.

Esempi

Visual Basic

'Connect to the local, default instance of SQL Server.
Dim srv As Server
srv = New Server
'Display the logins on the instance of SQL Server.
Dim lg As Login
For Each lg In srv.Logins
   Console.WriteLine(lg.Name)
Next

PowerShell

$srv = new-object Microsoft.SqlServer.Management.Smo.Server("(local)")
foreach ($lg in $srv.Logins)
{
   Write-Host $lg.Name
}