蓝总,求助怎么增加表b不重复新增编号一样的行
For Each v As String In DataTables("表A").GetValues("第一列")
Dim t As Table = Tables("表A") '定义一个变量t引用数据表
For i As Integer = 0 To t.Rows.Count - 1 Step 7
Dim pr As DataRow
If DataTables("表B").Compute("Count([_Identify])","编号 = '" & pr("编号") & "'") = 0 Then '加这个判断,要有2个值以上才执行下面代码,效率高
'Dim pr As DataRow
'pr = DataTables("表B").Find("编号 = '" & pr("编号") & "'")
'If pr IsNot Nothing Then
'Else
Dim dr1 As DataRow = DataTables("表B").AddNew()
dr1("日期") = t.Rows(i)("第一列")
dr1("编号") = t.Rows(i+1)("第一列")
dr1("甲") = t.Rows(i+2)("第一列")
dr1("乙") = t.Rows(i+3)("第一列")
dr1("丙") = t.Rows(i+4)("第一列")
dr1("丁") = t.Rows(i+5)("第一列")
dr1("方法") = t.Rows(i+6)("第一列")
End If
Next
Next
[此贴子已经被作者于2023/4/27 16:23:52编辑过]