DimsrsAsNewADODB.Recordset DimsnAsNewADODB.Connection Setsn=NewADODB.Connection sn.Open"Provider=sqlOLEDB.1;UserID='sa';Password='PW';InitialCatalog='DB';DataSource='SERVER'" sql="select*fromTB" srs.Opensql,sn,adOpenKeyset,adLockOptimistic LABEL1="目前数据库中共有"&srs.RecordCount&"条生产信息记录!"rs.RecordCount是记录集的总数 Setsys=Nothing Setsn=Nothing原文链接:https://www.f2er.com/vb/257737.html