采购单表有条件加载后,要加载采购单明细表。采购单明细表 只加载 采购单 里的现有行对应的明细,我的代码见灰色部分,有没有更简单的办法?我怕数据多了这种方式会很慢。
'采购单加载
DataTables("采购单").LoadFilter = "del = 1 and ([实际总价] > [已通知金额] or (Select count(*) from{采购订单} where del = 1 And 发货 = 0 And {采购订单}.采购订单编号 = {采购单}.编号) > 0 Or [已通知金额] Is null)"
DataTables("采购单").load
'采购订单明细加载
Dim jz As String
For Each jr As DataRow In DataTables("采购单").DataRows
jz = jz & "," & jr("编号")
Next
DataTables("采购订单明细").LoadFilter = "del = 1 and 采购订单编号 in (" & jz.trim(",") & ")"
DataTables("采购订单明细").load