tmpsql = "select * from SellerTable where 业务员编号='" & Trim(Text1.Text) & "'"
tmprst.Open tmpsql, cnn, adOpenDynamic, adLockOptimistic
If tmprst.EOF = False Then
MsgBox "你修改的采购员号已存,请核对后再修改!", vbCritical, "提示!"
Text1.SetFocus
tmprst.Close
Set tmprst = Nothing
TmpcnnClose
Exit Sub
End If
tmprst.Close
Set tmprst = Nothing
我这么写有问题吗,感觉就只做第一个记录的比较,而且这句If Adodc1.Recordset.EOF Then也不做直接到Else
************************************************************************
If intRetValue = 1 Then
ShowMessage "入库读取标签成功!"
Dim nCounter As Integer
ShowMessage "显示标签读取列表:"
For nCounter = 0 To 1 'intCurrentReaderReads - 1
intmyval = Communication.GetCurrentTagid(nCounter)
ShowMessage intmyval
Adodc1.RecordSource = "select * from 商品信息表 where Trim(商品EPC码)='" + Trim(intmyval) + "'"
If Adodc1.Recordset.EOF Then
myval = MsgBox("该编码已经存在,是否要添加到数据库?", vbYesNo, "提示!")
If myval = vbYes Then
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields("商品EPC码") = intmyval
Adodc1.Recordset.Update
Adodc1.Recordset.MoveLast
End If
Else
'myval = MsgBox("是否要添加到数据库?", vbYesNo, "提示!")
'If myval = vbYes Then
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields("商品EPC码") = intmyval
Adodc1.Recordset.Update
Adodc1.Recordset.MoveLast
' End If
End If
Next nCounter
'intCurrentReaderReads = 0
Else
ShowMessage "读取标签失败! 错误代码: " & intRetValue
End If
***************************************************************
dim cn as new adodb.connection
dim rs as new adodb.recordset
cn.open ........
set rs=cn.execute("select * from yourTableName where 条形码字段名=扫描得到的条形码")
if rs.eof then msgbox "没有相同的记录"