Foxtable(狐表)用户栏目专家坐堂 → [求助]窗口修改时怎么体现独占式编辑


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

主题:[求助]窗口修改时怎么体现独占式编辑

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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/5/20 19:28:00 [显示全部帖子]

在Datacolchanging事件,加入代码

 

If e.DataCol.Name <> "编辑者" Then
    If e.DataRow("编辑者") = User.Name Then '如果编辑者是当前用户
        Return
    End If
    Dim cmd As New SQLCommand
    Dim exp As String  = "编辑者 Is Null And [_Identify] = " & e.DataRow("_Identify")
    cmd.CommandText = "U pdate {内供} Set 编辑者 = '" & User.Name & "' Where " & exp
    If cmd.ExecuteNonQuery = 1 Then
        e.DataRow("编辑者") = User.Name
    Else
        cmd.CommandText = "S elect 编辑者 From {内供} Where [_Identify] = " & e.DataRow("_Identify")
        Dim nm As String = cmd.ExecuteScalar
        If nm > "" Then
            MessageBox.show(nm & "正在编辑此行!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
        Else
            MessageBox.show("此行可能已经被删除,无法编辑!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
        End If
        e.Cancel = True '取消编辑
    End If
End If


 回到顶部