Users on an MS Access Database
These Functions will allow you to determine WHO is logged on to the Acces Database as well as HOW MANY users are logged-in. As always the code is FREE, if you want support can consult me in my professional capacity. ENJOY
AI
สรุปโดย AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
ซอร์สโค้ด
Public Function EmptyRS(ByVal oRS) As Boolean
On Error Resume Next
'Checks for an EMPTY RecordSet
EmptyRS = True
If Not oRS Is Nothing Then
EmptyRS = ((oRS.BOF = True) And (oRS.EOF = True))
End If
End Function
Public Function GetDBUsers() As ADODB.Recordset
' NOTES: Fields as follows
' 0 - COMPUTER_NAME: Workstation
' 1 - LOGIN_NAME: Name used to Login to DB
' 2 - CONNECTED: True if Lock in LDB File
' 3 - SUSPECTED_STATE: True if user has left database in a suspect state(else Null)
On Error GoTo LocalError
Const JET_SCHEMA_USERROSTER = "{947bb102-5d43-11d1-bdbf-00c04fb92675}"
' Return a Disconnected RecordSet
If cnADO.State = adStateOpen Then
Set GetDBUsers = cnADO.OpenSchema(adSchemaProviderSpecific, , JET_SCHEMA_USERROSTER)
Set GetDBUsers.ActiveConnection = Nothing
End If
LocalError:
End Function
Public Function GetDBUserCount() As Long
On Error GoTo LocalError
Dim lRS As ADODB.Recordset
Set lRS = GetDBUsers
If Not EmptyRS(lRS) Then
GetDBUserCount = lRS.RecordCount
lRS.Close
End If
LocalError:
Set lRS = Nothing
End Function
ความคิดเห็นดั้งเดิม (3)
กู้คืนจาก Wayback Machine