Hi,
I have a legacy clien-server application that runs on a server and one client. I log into machine(the client) using the Administrator id. After I close the application, I tried running the following code ( obtained from MS Knowledge Base) to determine if any users are still logged onto the database.
Dim cn As New ADODB.Connection
Dim cn2 As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim i, j As Long
cn.Provider = "Microsoft.Jet.OLEDB.4.0"
cn.Open "Data Source=c:\AppEx\AppEx.mdb"
cn2.Open "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=C:\AppEx\AppEx.mdb"
' The user roster is exposed as a provider-specific schema rowset
' in the Jet 4 OLE DB provider. You have to use a GUID to
' reference the schema, as provider-specific schemas are not
' listed in ADO's type library for schema rowsets
Set rs = cn.OpenSchema(adSchemaProviderSpecific, _
, "{947bb102-5d43-11d1-bdbf-00c04fb92675}"
'Output the list of all users in the current database.
Debug.Print rs.Fields(0).Name, "", rs.Fields(1).Name, _
"", rs.Fields(2).Name, rs.Fields(3).Name
While Not rs.EOF
Debug.Print rs.Fields(0), rs.Fields(1), _
rs.Fields(2), rs.Fields(3)
rs.MoveNext
Wend
And surprisingly I found that the Adminstrator of my machine was still logged on. Now I need a way to log out this guy also from the database.
This is really urgent and important. Any help in this matter would be very much appreciated.
Thanks a lot in advance.
With regards,
PGK
I have a legacy clien-server application that runs on a server and one client. I log into machine(the client) using the Administrator id. After I close the application, I tried running the following code ( obtained from MS Knowledge Base) to determine if any users are still logged onto the database.
Dim cn As New ADODB.Connection
Dim cn2 As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim i, j As Long
cn.Provider = "Microsoft.Jet.OLEDB.4.0"
cn.Open "Data Source=c:\AppEx\AppEx.mdb"
cn2.Open "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=C:\AppEx\AppEx.mdb"
' The user roster is exposed as a provider-specific schema rowset
' in the Jet 4 OLE DB provider. You have to use a GUID to
' reference the schema, as provider-specific schemas are not
' listed in ADO's type library for schema rowsets
Set rs = cn.OpenSchema(adSchemaProviderSpecific, _
, "{947bb102-5d43-11d1-bdbf-00c04fb92675}"
'Output the list of all users in the current database.
Debug.Print rs.Fields(0).Name, "", rs.Fields(1).Name, _
"", rs.Fields(2).Name, rs.Fields(3).Name
While Not rs.EOF
Debug.Print rs.Fields(0), rs.Fields(1), _
rs.Fields(2), rs.Fields(3)
rs.MoveNext
Wend
And surprisingly I found that the Adminstrator of my machine was still logged on. Now I need a way to log out this guy also from the database.
This is really urgent and important. Any help in this matter would be very much appreciated.
Thanks a lot in advance.
With regards,
PGK