Foxtable(狐表)用户栏目专家坐堂 → 多列数据是否可以使用同一个代码 禁止输入重复数据


  共有2359人关注过本帖树形打印复制链接

主题:多列数据是否可以使用同一个代码 禁止输入重复数据

帅哥哟,离线,有人找我吗?
夜点蚊香
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:三尾狐 帖子:606 积分:4655 威望:0 精华:0 注册:2020/4/15 19:53:00
多列数据是否可以使用同一个代码 禁止输入重复数据  发帖心情 Post By: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)提示框中的列名应该如何表示.

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:107660 积分:547615 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By: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

 回到顶部