取最大值问题。

36B 2003-04-11 02:51:49
当几个客户同时按添加时,同时处于BindingContext(ds, "tb")addnew()的状态,若按下面代码求最大值会出现重复,请问各位应如何修改?
If Me.editbh.Text = "" Then
Dim dt As DataTable = CType(ds.tb, DataTable)
Dim dr As DataRow() = dt.Select("2>1", "bh Desc")
If getpos(ds.Tables(0), dr(0).Item("bh"), "bh") = (Me.ds.Tables("tb").Rows.Count - 1) Then
Me.editbh.Text = dr(0).Item("bh") + 2
Else
Me.editbh.Text = dr(0).Item("bh") + 1
End If
end if
...全文
19 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
saucer 2003-04-14
  • 打赏
  • 举报
回复
you want to study on concurrency control, since it is your data, you have to decide on your own

Concurrency Control in ADO.NET
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vboridataupdatesconcurrency.asp

Tackle Data Concurrency Exceptions Using the DataSet Object
http://msdn.microsoft.com/msdnmag/issues/03/04/DataConcurrency/default.aspx
Dugu_Niu 2003-04-11
  • 打赏
  • 举报
回复
gz

16,554

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧