Dim time1 As Date = Functions.Execute("SQLTIME")
e.Form.Controls("Label1").Text = "正在增加行,请稍后..."
Application.DoEvents()
Dim tb As DataTable = e.Form.Controls("Table1").Table.DataTable
Dim tbltaizhang As DataTable = e.Form.Controls("Table2").Table.DataTable
tb.StopRedraw
Dim cmb年度 As WinForm.ComboBox = e.Form.Controls("cmb年度")
Dim mydate As Date = Functions.Execute("SQLTIME")
Dim nlist As new List(Of DataRow)
Dim dic As new Dictionary(Of DataRow, 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.DataRow, wz)
Else
nlist.Add(ydr.DataRow)
End If
Next
For Each ydr As DataRow In nlist
Dim nr As DataRow = 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 DataRow In dic.Keys
Dim nr As DataRow = tb.rows(dic(ydr)).DataRow
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") & "秒"