str = Frame(7) & Frame(8) & Frame(9) & Frame(10) & Frame(11) & Frame(12) & Frame(13) & Frame(14)
//这里str为带双引号的字符串"123456",但sql语句只支持单引号
Call OpenConn
sqlm = "select * from dev_info where mac =
'
"
& str &
"
' "
//这里可以把“123456”变成'123456' rs.Open sqlm,cn,3,3 If rs.RecordCount >= 1 Then '记录重复 rs.Close Call CloseConn Exit Sub Else rs.AddNew If Frame(4) = "00" Then rs!dev_type = "M1" ElseIf Frame(4) = "01" Then rs!dev_type = "M2" ElseIf Frame(4) = "02" Then rs!dev_type = "M3" End If rs!Mac = str rs!short_addr = Frame(5) & Frame(6) rs!dev_name = "未命名" rs!group_name = "未分组" rs.Update rs.Close End If Call CloseConn