用QueryBuilder生成的查询表”名册",下面代码的目的是:从“bzkh”表查找符合条件、而"名册"表中不含的bh值。如果找到的话,在"名册"表增加一行,并将找到的bh值填入新增行的bh列。代码运行发现,可以增加行,但是却无法填入bh值,不知何故,请各位老师指教,谢谢!!
For Each dr1 As DataRow In DataTables("bzkh").DataRows
If dr1.IsNull("bh") = False Then
If dr1("qdb2") = db And dr1("pzrq") >= yc1 And dr1("pzrq") <= yd1 Then '
Dim pr As DataRow = DataTables("名册").Find("bh = '" & dr1("bh") & "'")
If pr Is Nothing Then '没有此编号
Dim dr2 As Row = Tables("名册").AddNew()
dr2("bh") = dr1("bh")
End If
End If
End If
Next