代码放到startedit事件
If e.Table.Cols.Contains("审核") AndAlso e.Table.IsRelation =False Then
If e.Row("审核") = True AndAlso e.Col.Name <> "审核" Then '本条记录审核后禁止编辑除审核外的所有列
e.Cancel = True
ElseIf e.Row("审核") = False Then '未审核的记录在编辑前检查是否在后台已经被审核
Dim cmd As New SQLCommand
cmd.C
cmd.C ommandText = "S elect [审核] F rom {生产计划辅表} Where [_Identify] = " & e.Row("_Identify") '这里必须使用数据库的表名,不能使用窗口表名称
Dim sh As Boolean = cmd.ExecuteScalar() '后台读取的审核列值赋值给sh变量
If sh = True Then
MessageBox.Show("本条记录已经在后台被审核,现已重新加载!" , "提示" , MessageBoxButtons.OK ,MessageBoxIcon.Information)
End If
End If
End If