以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  多列数据是否可以使用同一个代码 禁止输入重复数据  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=157433)

--  作者:夜点蚊香
--  发布时间:2020/10/15 23:57:00
--  多列数据是否可以使用同一个代码 禁止输入重复数据
\'禁止姓名 身份证号 重复
Select Case e.DataCol.Name
    Case "姓名" , "身份证号"
        If e.NewValue IsNot Nothing Then \'如果已经输入订单号
            Dim dr As DataRow = e.DataTable.find("e.datacol.name = \'" & e.NewValue & "\'")
            If dr IsNot Nothing Then
                MessageBox.Show("姓名已存在!请加入备注.","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
                e.cancel = True
            End If
        End If
End Select

现在用的是这个代码 请问 Dim dr As DataRow = e.DataTable.find("e.datacol.name = \'" & e.NewValue & "\'") 中的列名  和MessageBox.Show("姓名已存在!请加入备注.","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)提示框中的列名应该如何表示.

--  作者:有点蓝
--  发布时间:2020/10/16 8:31:00
--  
Select Case e.DataCol.Name
    Case "姓名" , "身份证号"
        If e.NewValue IsNot Nothing Then \'如果已经输入订单号
            Dim dr As DataRow = e.DataTable.find(e.datacol.name & " = \'" & e.NewValue & "\'")
            If dr IsNot Nothing Then
                MessageBox.Show(e.datacol.name & "已存在!请加入备注.","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
                e.cancel = True
            End If
        End If
End Select