Foxtable(狐表)用户栏目专家坐堂 → 如何防止出现相同采购单号和采购单行号的行


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

主题:如何防止出现相同采购单号和采购单行号的行

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


加好友 发短信
等级:七尾狐 帖子:1505 积分:9756 威望:0 精华:0 注册:2014/12/18 16:12:00
如何防止出现相同采购单号和采购单行号的行  发帖心情 Post By:2019/6/10 13:40:00 [只看该作者]

Select Case e.DataCol.name
    Case "采购单号"
        If e.NewValue > "" AndAlso e.DataRow.IsNull("采购单行号") = False
            Dim dr As DataRow = e.DataRow
            If e.DataTable.Find("采购单号 = '" & e.NewValue & "' And 采购单行号 =" & dr("采购单行号")) IsNot Nothing Then
                MessageBox.Show("已经存在相同采购单号和采购单行号的行!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
                e.Cancel = True
            End If
        End If
    Case "采购单行号"
        If  e.NewValue > "" AndAlso e.DataRow.IsNull("采购单号") = False
            Dim dr As DataRow = e.DataRow
            If e.DataTable.Find("采购单行号 = '" & e.NewValue & "' And 采购单号 =" & dr("采购单号")) IsNot Nothing Then
                MessageBox.Show("已经存在相同采购单号和采购单行号的行!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
                e.Cancel = True
            End If
        End If
End Select

上面代号的目的是为了防止出现相同采购单号和采购单行号的行。但是执行Case "采购单行号"时会出现警告:
.NET Framework 版本:2.0.50727.8806
Foxtable 版本:2017.10.16.1
错误所在事件:表,采购单,DataColChanging
详细错误信息:
调用的目标发生了异常。
未找到列 [BSPOE024]。

请教是什么问题。谢谢。
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目4.rar



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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2019/6/10 14:47:00 [只看该作者]

Select Case e.DataCol.name
    Case "采购单号"
        If e.NewValue > "" AndAlso e.DataRow.IsNull("采购单行号") = False
            Dim dr As DataRow = e.DataRow
            If e.DataTable.Find("采购单号 = '" & e.NewValue & "' And 采购单行号 = '" & dr("采购单行号") & "'") IsNot Nothing Then
                MessageBox.Show("已经存在相同采购单号和采购单行号的行!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
                e.Cancel = True
            End If
        End If
    Case "采购单行号"
        If  e.NewValue > "" AndAlso e.DataRow.IsNull("采购单号") = False
            Dim dr As DataRow = e.DataRow
            If e.DataTable.Find("采购单行号 = '" & e.NewValue & "' And 采购单号 = '" & dr("采购单号") & "'") IsNot Nothing Then
                MessageBox.Show("已经存在相同采购单号和采购单行号的行!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
                e.Cancel = True
            End If
        End If
End Select

 回到顶部