If e.Form.Controls("称谓").text = "" Or e.Form.Controls("性别").text = "" Then
Messagebox.show(" 添加数据时不能存在空值!")
ElseIf e.Form.controls("称谓").text <>"" Then
Dim dt As DataRow = DataTables("称谓_Table1").find("称谓 = '"& e.Form.Controls("称谓").text & "'")
If dt IsNot Nothing
If e.Form.Controls("称谓").text = dt("称谓") And e.Form.Controls("性别").text = dt("性别") And dt("DEL") = 1 Then
messagebox.show("该值已经存在,请不要重复添加!")
Return
End If
Return
End If
Dim Result As DialogResult
Result = MessageBox.Show("您确定添加吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If Result = DialogResult.Yes Then
Dim nr As Row = Tables("称谓_Table1").AddNew
If e.Form.Controls("称谓").text <> "" Then
nr("称谓") = CStr(e.Form.Controls("称谓").text)
End If
If e.Form.Controls("性别").text <> "" Then
nr("性别") = CStr(e.Form.Controls("性别").text)
End If
nr.Save
MessageBox.Show("数据添加成功!")
DataTables("称谓表").Load
End If
End If
[此贴子已经被作者于2014-6-19 13:47:09编辑过]