[導讀]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綠色c hinaip ower. com0LUHD cn.Provider = Microsoft.Jet.OLEDB.4.0 cn.Open Data Source=c:\Northwind.mdb綠色c hinaip ower. com0LUHD cn2.Op
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綠色c hinaip ower. com0LUHD
cn.Provider = "Microsoft.Jet.OLEDB.4.0"
cn.Open "Data Source=c:\Northwind.mdb"綠色c hinaip ower. com0LUHD
cn2.Open "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=c:\Northwind.mdb"綠色c hinaip ower. com0LUHD
' 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綠色c hinaip ower. com0LUHD
Set rs = cn.OpenSchema(adSchemaProviderSpecific, _
, "{947bb102-5d43-11d1-bdbf-00c04fb92675}")綠色c hinaip ower. com0LUHD
'Output the list of all users in the current database.綠色c hinaip ower. com0LUHD
Debug.Print rs.Fields(0).Name, "", rs.FIElds(1).Name, _
"", rs.Fields(2).Name, rs.FIElds(3).Name綠色c hinaip ower. com0LUHD
While Not rs.EOF
Debug.Print rs.Fields(0), rs.FIElds(1), _
rs.Fields(2), rs.FIElds(3)
rs.MoveNext
Wend綠色c hinaip ower. com0LUHD
End Sub
綠色c hinaip ower