Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Call Main
Select Case Button.Index
Case 1
If Text1.Text = "" Or Text2.Text = "" Then
MsgBox "带*为必填,请检查!"
Exit Sub
Else
sql = "select * from installdata WHERE product_id = '" & Text1.Text & "'"
rs.Open sql, cn, adOpenStatic, adLockReadOnly
If rs.RecordCount > 0 Then
MsgBox "该工号已存在,请重新输入!"
Else
sql = "INSERT INTO installdata (product_id,contract_id)VALUES ('" & Text1.Text & "','" & Text2.Text & "')"
cn.Execute sql
MsgBox "添加成功!"
End If
End If
End Select
End sub

Call Main
Select Case Button.Index
Case 1
If Text1.Text = "" Or Text2.Text = "" Then
MsgBox "带*为必填,请检查!"
Exit Sub
Else
sql = "select * from installdata WHERE product_id = '" & Text1.Text & "'"
rs.Open sql, cn, adOpenStatic, adLockReadOnly
If rs.RecordCount > 0 Then
MsgBox "该工号已存在,请重新输入!"
Else
sql = "INSERT INTO installdata (product_id,contract_id)VALUES ('" & Text1.Text & "','" & Text2.Text & "')"
cn.Execute sql
MsgBox "添加成功!"
End If
End If
End Select
End sub

