1.rst1.Open "Product", dbcn, adOpenKeyset, adLockOptimistic, adCmdTablewith rst1
if not(.eof and .bof) then
rs.find "ID =" & val(txtID.text)
if .eof then
'不重复
else
'有重复的.
endif
endif
end with2.
rst1.Open "select * from Product where ID=" & val(txtID.text), dbcn, adOpenKeyset, adLockOptimistic, adCmdTableif not(.eof and .bof ) then
'有重复
else
'没有重
endif注:
第一种是在记录集中查找,第二中是在数据库查找.
假设ID为数值类型.
if not(.eof and .bof) then
rs.find "ID =" & val(txtID.text)
if .eof then
'不重复
else
'有重复的.
endif
endif
end with2.
rst1.Open "select * from Product where ID=" & val(txtID.text), dbcn, adOpenKeyset, adLockOptimistic, adCmdTableif not(.eof and .bof ) then
'有重复
else
'没有重
endif注:
第一种是在记录集中查找,第二中是在数据库查找.
假设ID为数值类型.
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货