我有个订单表和订单明细表,在录入完数据后,我首先要判断订单明细表的编码和金额列是空的,先删除数据,然后在把订单表的当前数据ID写入到订单明细表的当前所有增加的行的ID列,下面的代码感觉很慢还会闪,求高手优化一下,谢谢!
For Each dD As DataRow In DataTables("DINGDAN").DataRows
If dD.IsNull("JIGOU") Or dD.IsNull("CANGKU") Or dD.IsNull("GONGYS")
MessageBox.Show("【机构】【仓库】【供应商】不能为空!","提示" )
End If
Next
For Each dr As DataRow In DataTables("RUKU_TABLE1").DataRows
If dr("编码") = "" Or dr.IsNull("金额") Then
dr.Delete()
DataTables("dingdan").Save
For Each dr1 As DataRow In DataTables("RUKU_TABLE1").DataRows
If dr1.IsNull("id") Then
dr1("id") = Tables("DINGDAN").Current("id")
End If
Next
DataTables("RUKU_TABLE1").Save
End If
Next