以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  命令顺序执行,禁止同时执行  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=191463)

--  作者:liuandwang
--  发布时间:2024/4/18 16:15:00
--  命令顺序执行,禁止同时执行
按键命令:目的是备份主表和明细表,并在备份完成后删除主表和明细表
主表和明细表通过“订单编号”关联,在执行命令时,提示所在行已删除无法复制,
或者备份的主表内容与原表不一致,如面积列,通过公式汇总明细表

应该是复制命令执行完全后,再执行删除命令,怎么做,拜托!!!

Dim Cols1() As String = {"订单编号", "接单日期", "产品名称", "面积".......}
Dim Cols2() As String = {"订单编号", "接单日期", "产品名称", "面积".......}
For Each dr1 As DataRow In DataTables("订单主表").Select("[核销] =\'√\'")
    Dim dr2 As DataRow = DataTables("主表归档").AddNew()
    For i As Integer = 0 To Cols1.Length - 1
        dr2(Cols2(i)) = dr1(Cols1(i)) 
    Next 
    dr1.Delete
Next

Dim Cols3() As String = {"订单编号", "接单日期", "产品名称", "产品颜色".......}
Dim Cols4() As String = {"订单编号", "接单日期", "产品名称", "产品颜色".......}
For Each dr3 As DataRow In DataTables("订单明细表").Select("[核销] =\'√\'")
    Dim dr4 As DataRow = DataTables("明细表归档").AddNew()
    For k As Integer = 0 To Cols3.Length - 1
        dr4(Cols4(k)) = dr3(Cols3(k)) 
    Next 
    dr3.Delete
Next

--  作者:有点蓝
--  发布时间:2024/4/18 16:17:00
--  
Dim Cols1() As String = {"订单编号", "接单日期", "产品名称", "面积".......}
Dim Cols2() As String = {"订单编号", "接单日期", "产品名称", "面积".......}
For Each dr1 As DataRow In DataTables("订单主表").Select("[核销] =\'√\'")
    Dim dr2 As DataRow = DataTables("主表归档").AddNew()
    For i As Integer = 0 To Cols1.Length - 1
        dr2(Cols2(i)) = dr1(Cols1(i)) 
    Next 
Next

Dim Cols3() As String = {"订单编号", "接单日期", "产品名称", "产品颜色".......}
Dim Cols4() As String = {"订单编号", "接单日期", "产品名称", "产品颜色".......}
For Each dr3 As DataRow In DataTables("订单明细表").Select("[核销] =\'√\'")
    Dim dr4 As DataRow = DataTables("明细表归档").AddNew()
    For k As Integer = 0 To Cols3.Length - 1
        dr4(Cols4(k)) = dr3(Cols3(k)) 
    Next 
Next
DataTables("订单明细表").deletefor("[核销] =\'√\'")
DataTables("订单主表").deletefor("[核销] =\'√\'")