Dim cmd As New SQLCommand
Dim dt As DataTable
Dim Cols1() As String = {"dh","hh","sl"}
Dim Cols2() As String = {"dh","hh","sl"}
cmd.C
cmd.CommandText = "SELECT dh,hh,sl From {mjcomtxmxhz} where gx='配线' and dh<>'' and hh <>'' AND dh+hh not in(SELECT [dh]+[hh] FROM [zzmjcomtxmxhz])"
dt = cmd.ExecuteReader()
Tables("zzmjcomtxmxhz").StopRedraw
For Each dr1 As DataRow In dt.DataRows
Dim dr2 As DataRow = DataTables("zzmjcomtxmxhz").AddNew()
dr2("单号") = Tables("zzmjcomtxmxzb").current("单号")
For i As Integer = 0 To Cols1.Length -1
dr2(Cols2(i)) = dr1(Cols1(i))
Next
Next
Tables("zzmjcomtxmxhz").ResumeRedraw