다음을 통해 공유


ActiveConnections 속성

데이터베이스에 대한 활성 연결의 수를 가져옵니다.

네임스페이스:  Microsoft.SqlServer.Management.Smo
어셈블리:  Microsoft.SqlServer.Smo(Microsoft.SqlServer.Smo.dll)

구문

‘선언
<SfcPropertyAttribute(SfcPropertyFlags.None Or SfcPropertyFlags.Expensive Or SfcPropertyFlags.Standalone)> _
Public ReadOnly Property ActiveConnections As Integer
    Get
‘사용 방법
Dim instance As Database
Dim value As Integer

value = instance.ActiveConnections
[SfcPropertyAttribute(SfcPropertyFlags.None|SfcPropertyFlags.Expensive|SfcPropertyFlags.Standalone)]
public int ActiveConnections { get; }
[SfcPropertyAttribute(SfcPropertyFlags::None|SfcPropertyFlags::Expensive|SfcPropertyFlags::Standalone)]
public:
property int ActiveConnections {
    int get ();
}
[<SfcPropertyAttribute(SfcPropertyFlags.None|SfcPropertyFlags.Expensive|SfcPropertyFlags.Standalone)>]
member ActiveConnections : int
function get ActiveConnections () : int

속성 값

유형: System. . :: . .Int32
데이터베이스의 활성 연결 수를 지정하는 Int32 값입니다.

주의

The ActiveConnections property returns the active connections for the referenced database. Use the GetActiveDBConnectionCount method to return the total database connections on the instance of SQL Server.

VB

'Connect to the local, default instance of SQL Server.
Dim srv As Server
srv = New Server()

'Reference the AdventureWorks2008R2 database.
Dim db As Database
db = srv.Databases("AdventureWorks2008R2")

'Display the number of active connections to the database.
Console.WriteLine(db.ActiveConnections)

PowerShell

$srv = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")
$db = New-Object Microsoft.SqlServer.Management.Smo.Database
$db = $srv.Databases.Item("AdventureWorks2008R2")
Write-Host $db.ActiveConnections