Dim nms As String
Dim ids1 As String
For Each dr As DataRow In DataTables("发车扫描").DataRows
nms = nms & ",'" & dr("派车单号") & "'"
Next
If nms > "" Then
nms = nms.Trim(",")
Dim cmd As New SQLCommand
Dim dt As DataTable
cmd.Con necti
cmd.CommandText = "SEL ECT 派车单号,运单编号 From {发货_配载明细} Where [派车单号] In (" & nms & ")"
dt = cmd.ExecuteReader()
If dt.DataRows.Count = 0 Then '如果订单表没有数据
DataTables("运单管理").LoadFilter = "运单编号 Is Null" '不加载订单明细
Else
For Each dx As DataRow In dt.DataRows
ids1 = ids1 & ",'" & dx("运单编号") & "'"
Next
If ids1 > "" Then
ids1 = ids1.Trim(",")
DataTables("运单管理").LoadFilter = "[运单编号] In (" & ids1 &")"
DataTables("运单管理").Load()
End If
End If
End If
这个是代码