要是这条路不好走,那我用新的办法,您帮我看看,这段代码上下部分有没有问题?
是不是可以合并?怎么合并?
If e.Row("编辑者") = User.Name Then '如果编辑者是当前用户
Return
End If
Dim cmd2 As New SQLCommand
Dim exp2 As String = "编辑者 Is Null And [_Identify] = " & e.Row("_Identify")
cmd2.Connectio nNam e = "仓管系统"
cmd2.CommandText = "U pdate {入库表} Set 编辑者 = '" & User.Name & "' Where " & exp2
If cmd2.ExecuteNonQuery = 1 Then
e.Row("编辑者") = User.Name
Else
cmd2.CommandText = "Select 编辑者 F rom {入库表} Where [_Identify] = " & e.Row("_Identify")
Dim nm2 As String = cmd2.ExecuteScalar
If nm2 > "" Then
MessageBox.show(nm2 & "正在编辑此行!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Else
MessageBox.show("此行可能已经被删除,无法编辑!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If
e.Cancel = True '取消编辑
End If
Dim cmd As New SQLCommand
cmd.Connectio nNam e = "仓管系统"
Dim id As Integer = e.Row("_Identify")
cmd.CommandText = "Select 用户名 F rom {入库表} Where [_Identify] = " & id
Dim nm As String = cmd.ExecuteScalar
If nm <> User.Name Then
e.Table.DataTable.load()
Tables("入库表窗口_入库表").Position = Tables("入库表窗口_入库表").Rows.Count - 1
End If
[此贴子已经被作者于2020/3/3 10:57:07编辑过]