Condividi tramite


Metodo ServerConnection.IsInFixedServerRole

Tests whether the logon associated with the referenced connection is a member of the specified fixed server role.

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

Sintassi

'Dichiarazione
Public Function IsInFixedServerRole ( _
    fixedServerRole As FixedServerRoles _
) As Boolean
'Utilizzo
Dim instance As ServerConnection 
Dim fixedServerRole As FixedServerRoles 
Dim returnValue As Boolean 

returnValue = instance.IsInFixedServerRole(fixedServerRole)
public bool IsInFixedServerRole(
    FixedServerRoles fixedServerRole
)
public:
bool IsInFixedServerRole(
    FixedServerRoles fixedServerRole
)
member IsInFixedServerRole : 
        fixedServerRole:FixedServerRoles -> bool
public function IsInFixedServerRole(
    fixedServerRole : FixedServerRoles
) : boolean

Parametri

Valore restituito

Tipo: System.Boolean
A Boolean value that specifies whether the logon is a member of the specified fixed server role.If True, the logon is a member of the specified fixed server role.If False, the logon is not a member of the specified fixed server role.

Esempi

C#

ServerConnection conn = new ServerConnection();
conn.DatabaseName = "AdventureWorks2012";
Console.WriteLine(conn.IsInFixedServerRole(FixedServerRoles.SysAdmin));

PowerShell

$conn = new-object Microsoft.SqlServer.Management.Common.ServerConnection
$conn.DatabaseName = "AdventureWorks2012"
Write-Host $conn.IsInFixedServerRole([Microsoft.SqlServer.Management.Common.FixedServerRoles]::SysAdmin)

Vedere anche

Riferimento

ServerConnection Classe

Spazio dei nomi Microsoft.SqlServer.Management.Common

Altre risorse

Autorizzazioni dei ruoli predefiniti del server (Motore di database)