static pval As String = "" If e.DataCol.Name = "列A" Then If e.DataRow.IsNull("列A") = False Then If pval <> e.newvalue Then Dim ro As DataRow = DataTables("表A").SQLFind("列A = '" & e.NewValue & "'") If ro Is Nothing Then MessageBox.Show("不存在该名称,请先添加!","提醒") pval = e.newvalue e.Cancel = True Return End If End If End If End If