Foxtable(狐表)用户栏目专家坐堂 → 独占式编辑之一的项目的问题?


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

主题:独占式编辑之一的项目的问题?

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


加好友 发短信
等级:超级版主 帖子:106209 积分:540168 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2020/3/10 15:58:00 [显示全部帖子]

编辑者锁定了,不能直接编辑,编辑其它列的时候会自动保存。

datacolchanging事件改改
If e.DataRow("编辑者") = User.Name Then '如果编辑者是当前用户
    Return
End If
systemready = False
Dim cmd As New SQLCommand
cmd.ConnectionName = "仓管系统"
Dim id As Integer = e.DataRow("_Identify")
cmd.CommandText = "Select 用户名 From {入库表} Where [_Identify] = " & id
Dim nm As String = cmd.ExecuteScalar
If nm <> User.Name Then
    e.DataRow.Load()
End If
systemready = True
'msgbox(e.DataCol.Name)
Dim cmd2 As New SQLCommand
Dim exp2 As String  = "编辑者 Is Null And [_Identify] = " & e.DataRow("_Identify")
cmd2.ConnectionName = "仓管系统"
cmd2.CommandText = "Update {入库表} Set 编辑者 = '" & User.Name & "' Where " & exp2
If cmd2.ExecuteNonQuery = 1 Then
    systemready = False
    e.DataRow("编辑者") = User.Name
    systemready = True
Else
    cmd2.CommandText = "Select 编辑者 From {入库表} Where [_Identify] = " & e.DataRow("_Identify")
    Dim nm2 As String = cmd2.ExecuteScalar
    If nm2 = User.Name Then Return
    If nm2 > "" Then
        MessageBox.show(nm2 & "正在编辑此行!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
    Else
        MessageBox.show("此行可能已经被删除,无法编辑!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
    End If
    e.Cancel = True '取消编辑
End If

 回到顶部
总数 12 上一页 1 2