如何确定有多少人登陆数据库?
2008-12-26 00:00:00 来源:WEB开发网SubShowUserRosterMultipleUsers()
DimcnAsNewADODB.Connection
Dimcn2AsNewADODB.Connection
DimrsAsNewADODB.Recordset
Dimi,jAsLong
cn.Provider="Microsoft.Jet.OLEDB.4.0"
cn.Open"DataSource=c:Northwind.mdb"
cn2.Open"Provider=Microsoft.Jet.OLEDB.4.0;"_
&"DataSource=c:Northwind.mdb"
'Theuserrosterisexposedasaprovider-specificschemarowset
'intheJet4OLEDBprovider. YouhavetouseaGUIDto
'referencetheschema,asprovider-specificschemasarenot
'listedinADO'stypelibraryforschemarowsets
Setrs=cn.OpenSchema(adSchemaProviderSpecific,_
,"{947bb102-5d43-11d1-bdbf-00c04fb92675}")
'Outputthelistofallusersinthecurrentdatabase.
Debug.Printrs.Fields(0).Name,"",rs.Fields(1).Name,_
"",rs.Fields(2).Name,rs.Fields(3).Name
WhileNotrs.EOF
Debug.Printrs.Fields(0),rs.Fields(1),_
rs.Fields(2),rs.Fields(3)
rs.MoveNext
Wend
EndSub
更多精彩
赞助商链接