Foxtable(狐表)用户栏目专家坐堂 → 避免多人同时编辑同一行的例子疑问?{已解决}


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

主题:避免多人同时编辑同一行的例子疑问?{已解决}

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


加好友 发短信
等级:三尾狐 帖子:682 积分:5263 威望:0 精华:0 注册:2012/6/6 14:37:00
避免多人同时编辑同一行的例子疑问?{已解决}  发帖心情 Post By:2013/10/10 23:07:00 [只看该作者]

If e.Row("编辑者") = User.Name Then '如果编辑者是当前用户
Return

End
If
Dim
cmd As New SQLCommand
Dim
exp As String = "编辑者 Is Null And [_Identify] = " & e.Row("_Identify")
cmd
.CommandText = "Update {员工} Set 编辑者 = '" & User.Name & "' Where " & exp
If
cmd.ExecuteNonQuery = 1 Then

e.Row("编辑者") = User.
Name    ‘这句不是在上面 UPDATE了吗???

Else

cmd.CommandText = "Select 编辑者 From {员工} Where [_Identify] = " & e.Row("_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



知道了!一个update的后台!  一个是更新的table
[此贴子已经被作者于2013-10-20 18:00:24编辑过]

 回到顶部