Select Case e.DataCol.Name Case "编号","是否入库" Dim dr As DataRow dr = DataTables("表1").Find("[编号] = '" & e.DataRow("编号") & "'" ) Dim drs = DataTables("表2").Select("[编号] = '" & e.DataRow("编号") & "' And [是否入库] Like '%入库%'","日期")
If dr Is Nothing Then dr = DataTables("表1").AddNew() End If dr("编号") = e.DataRow("编号")
If drs.count > 0 Then dr("第一入库日期") = drs(0)("日期") Else dr("第一入库日期") = Nothing
End If If drs.count > 1 Then dr("第二入库日期") = drs(1)("日期") Else dr("第二入库日期") = Nothing End If If drs.count > 2 Then dr("第三入库日期") = drs(2)("日期") Else dr("第三入库日期") = Nothing End If End Select