Dim dt1 As DataTable=datatables(“配置列")
Dim dr As DataRow
dr=dt1.Find("表名='"& e.DataTable.Name &"' And 列名='编码规则'")
If dr IsNot Nothing Then
Dim nms() As String=dr("使用表").Split(",")
Dim lm As String =dr("使用表对应列名")
Dim cmd As New SQLCommand
cmd.C
For i As Integer=0 To nms.Length-1
'MessageBox.Show(lm) ‘值为”编码规则“
'MessageBox.Show(e.DataRow("编码规则")) ’值为010101
cmd.CommandText ="Select Count(*) Fr om {"& nms(i) &"} Where lm='"& e.DataRow("编码规则") &"'"
If cmd.ExecuteScalar > 0 Then
Messagebox.Show("已使用","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Exit For
Else
Continue For
End If
Next
End If