怎样确定有多少人登陆数据库

WBOY
發布: 2016-06-07 16:22:34
原創
1315 人瀏覽過

Sub ShowUserRosterMultipleUsers() 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:Northwind.mdb cn2.Open Provider=Mic

  Sub ShowUserRosterMultipleUsers()

  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:Northwind.mdb"

  cn2.Open "Provider=Microsoft.Jet.OLEDB.4.0;" _

  "Data Source=c:Northwind.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

  End Sub

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板