Foxtable(狐表)用户栏目专家坐堂 → 多列重复


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

主题:多列重复

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


加好友 发短信
等级:一尾狐 帖子:470 积分:3641 威望:0 精华:0 注册:2017/11/5 14:47:00
多列重复  发帖心情 Post By:2018/6/9 10:43:00 [只看该作者]

Select Case e.DataCol.name
    Case "商品名称","规格型号"
        Dim spmc As String
        Dim ggxh As String
        If e.DataCol.Name= "商品名称" Then
            spmc = e.NewValue
            ggxh = e.DataRow("规格型号")
        Else
            ggxh = e.NewValue
            spmc = e.DataRow("商品名称")
        End If
        If spmc >= "" AndAlso ggxh  >= "" Then
            Dim dr As DataRow = e.DataRow
            If e.DataTable.Find("商品名称 = '" & spmc & "' And 规格型号 = '" & ggxh & "'") IsNot Nothing Then
                MessageBox.Show("已经存在相同商品名称和规格型号的商品!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
                e.Cancel = True
            End If
        End If
End Select

老师,我这段代码当商品没有输入规格型号的时候,可以再输入同样的商品名没有规格型号,也就是可以保存同样的没有输入规格型号的商品,这个应该怎么再设置一下呢,我试着写了,都不能成功,请指点一下


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


加好友 发短信
等级:超级版主 帖子:109720 积分:558310 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2018/6/9 11:50:00 [只看该作者]

……
If spmc >= "" AndAlso ggxh  >= "" Then
    Dim dr As DataRow = e.DataRow
    If e.DataTable.Find("商品名称 = '" & spmc & "' And 规格型号 = '" & ggxh & "'") IsNot Nothing Then
        MessageBox.Show("已经存在相同商品名称和规格型号的商品!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
        e.Cancel = True
    End If
ElseIf ggxh = ""
    Dim dr As DataRow = e.DataRow
    If e.DataTable.Find("商品名称 = '" & spmc & "'") IsNot Nothing Then
        MessageBox.Show("已经存在相同商品名称的商品!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
        e.Cancel = True
    End If
    
End If
……

 回到顶部