Foxtable(狐表)用户栏目专家坐堂 → 关于数据重复的问题


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

主题:关于数据重复的问题

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2017/7/26 22:19:00 [显示全部帖子]

beforesavedatarow事件

 

If e.DataRow("第五列") = False Then
    Dim arr() As String = {"第一列","第二列","第三列","第四列"}
    Dim s1 As String = ""
    Dim s2 As String = ""
    For Each cl As String In arr
        s1 = s1 & cl & "+'|'+"
        s2 = s2 & e.DataRow(cl) & "|"
    Next
    Dim filter As String  = s1.trim("+") & " = '" & s2 & "' and 第五列 = false"
    If e.DataTable.compute("count(_Identify)", filter) > 1 Then
        msgbox("重复")
        'e.DataRow.Delete
        e.cancel = True
    End If
End If


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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2017/7/26 23:22:00 [显示全部帖子]

DataColChanged

 

Select Case e.DataCol.Name
    Case "第一列","第二列","第三列","第四列","第五列"
        If e.DataRow("第五列") = False Then
            Dim arr() As String = {"第一列","第二列","第三列","第四列"}
            Dim s1 As String = ""
            Dim s2 As String = ""
            For Each cl As String In arr
                If e.DataRow.IsNull(cl) = True Then
                    s1 = ""
                    Exit For
                End If
                s1 = s1 & cl & "+'|'+"
                s2 = s2 & e.DataRow(cl) & "|"
            Next
            If s1 > "" Then
                Dim filter As String  = s1.trim("+") & " = '" & s2 & "' and 第五列 = false"
                If e.DataTable.compute("count(_Identify)", filter) > 1 Then
                    msgbox("重复")
                    'e.DataRow.Delete
                    e.cancel = True
                End If
            End If
        End If
End Select


 回到顶部