Dim time1 As Date = Functions.Execute("SQLTIME") e.Form.Controls("Label1").Text = "正在增加行,请稍后..." Application.DoEvents() Dim tb As Table = e.Form.Controls("Table1").Table Dim tbltaizhang As Table = e.Form.Controls("Table2").Table tb.StopRedraw Dim cmb年度 As WinForm.ComboBox = e.Form.Controls("cmb年度") Dim mydate As Date = Functions.Execute("SQLTIME") Dim nlist As new List(Of Row) Dim dic As new Dictionary(Of Row, Integer) For Each ydr As Row In tbltaizhang.Rows Dim wz As Integer = tb.FindRow("[台账号] = '" & ydr("台账号") & "' And [春检年度] = '" & cmb年度.Text & "'") If wz >= 0 Then dic.add(ydr, wz) Else nlist.Add(ydr) End If Next For Each ydr As Row In nlist Dim nr As Row = tb.AddNew nr("部门编号")= ydr("部门编号") nr("部门")= ydr("部门") nr("春检年度")= e.Form.Controls("cmb年度").text nr("台账号")= ydr("台账号") nr("台账号old")= ydr("台账号old") nr("地点")= ydr("地点") nr("台账名称")= ydr("台账名称") nr("录入人")= _UserTag nr("录入终端")= _UserPCip nr("录入日期")= mydate next For Each ydr As Row In dic.Keys Dim nr As Row = tb.rows(dic(ydr)) nr("部门编号")= ydr("部门编号") nr("部门")= ydr("部门") nr("春检年度")= e.Form.Controls("cmb年度").text nr("台账号")= ydr("台账号") nr("台账号old")= ydr("台账号old") nr("地点")= ydr("地点") nr("台账名称")= ydr("台账名称") nr("录入人")= _UserTag nr("录入终端")= _UserPCip nr("录入日期")= mydate next tb.ResumeRedraw Dim time2 As Date = Functions.Execute("SQLTIME") e.Form.Controls("Label1").Text = "耗时:" & Format((time2-time1).TotalSeconds,"0.0000") & "秒"
|