我使用此代码从访问数据库上连接的用户检索计算机名称和其他信息:
Sub ShowUsers(strDatabase As String)
Dim cnn As New ADODB.Connection
Dim rst As New ADODB.Recordset
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDatabase & ";Persist Security Info=False"
Set rst = cnn.OpenSchema(adSchemaProviderSpecific, , "{947bb102-5d43-11d1-bdbf-00c04fb92675}")
Debug.Print rst.Fields(0).Name, rst.Fields(1).Name, rst.Fields(2).Name, rst.Fields(3).Name
Do While Not rst.EOF
Debug.Print rst.Fields(0), rst.Fields(1), rst.Fields(2), rst.Fields(3)
rst.MoveNext
Loop
rst.Close
Set rst = Nothing
cnn.Close
Set cnn = Nothing
End Sub
现在我需要知道计算机名称中的用户名(aduser)吗?