第2个回答 2020-03-07
dim
i
as
long
'计数
dim
conn
as
new
adodb.connention
dim
rs
as
new
adodb.recordset
private
sub
commad1_click()
rs.Open
"select
*
from
table",
conn,
adOpenKeyset,
adLockOptimistic
if
rs.RecordCount<>
0
then
'查询数据库是否为空
for
i=0
to
rs.RecordCount-1
if
zy=rs.filed("姓名")
then
'判断所查数据是否等于zy
i=i+1
'等于则计数加一
endif
rs.movenext
next
i
enif
end
sub