Dim cmd As New SQLCommand
Dim dt As DataTable
cmd.C
cmd.CommandText = "SELECT * From {销售订单}"
dt = cmd.ExecuteReader()
For Each dr As DataRow In dt.DataRows
If DataTables("销售订单").Find("日期 = '" & dr("日期") & "'") Is Nothing Then
Dim nr As DataRow = DataTables("账面明细").AddNew()
For Each dc As DataCol In dt.DataCols
nr(dc.name) = dr(dc.name)
Next
End If
Next
按照自己表里的列名进行更改后测试无效!两张表列类型都一样
Dim cmd As New SQLCommand
Dim dt As DataTable
cmd.ConnectionName = "数据源名称"
cmd.CommandText = "SELECT * From {员工}"
dt = cmd.ExecuteReader()
For Each dr As DataRow In dt.DataRows
If DataTables("员工").Find("身份证号码 = '" & dr("身份证号码") & "'") Is Nothing Then
Dim nr As DataRow = DataTables("员工").AddNew()
For Each dc As DataCol In dt.DataCols
nr(dc.name) = dr(dc.name)
Next
End If
Next