If DataTables("订单").DataRows.Count = 0 Then '如果订单表没有数据 DataTables("订单明细").LoadFilter = "订单编号 Is Null" '不加载订单明细 Else Dim ids As String For Each dr As DataRow In DataTables("订单").DataRows ids = ids & ",'" & dr("订单编号") & "'" Next ids= ids.Trim(",") DataTables("订单明细").LoadFilter = "订单编号 In (" & ids & ")" End If DataTables("订单明细").Load()