以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助] 记录复制后不能删除  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=151051)

--  作者:leoli
--  发布时间:2020/6/13 21:46:00
--  [求助] 记录复制后不能删除


老师,你好,

以下的代码可以将记录复制到表ConfirmList,但复制后去不能把test 和test1表中相应的记录删除,麻烦一下,谢谢。



Dim Cols1() As String = {"FBrNo","FSupID","FItemID","FUnitID","FStartQty","FEndQty","FPrice","FCyID","FDiscount","FLeadTime","FQuoteTime","FUsed","FDisableDate","FRemark","FPType","FLastModifiedDate","FLastModifiedBy","FPrioritized"}   \'来源

Dim Cols2() As String = {"FBrNo","FSupID","FItemID","FUnitID","FStartQty","FEndQty","FPrice","FCyID","FDiscount","FLeadTime","FQuoteTime","FUsed","FDisableDate","FRemark","FPType","FLastModifiedDate","FLastModifiedBy","Priority"}   \'接收

For Each dr1 As DataRow In DataTables("Pricelist").Select("[FNeg] = true ")
If DataTables("test").find("ID=\'" & dr1("ID") & "\'") Is Nothing Then
    Dim dr2 As DataRow = DataTables("ConfirmList").AddNew()
    For i As Integer = 0 To Cols1.Length -1
        dr2(Cols2(i)) = dr1(Cols1(i))
        dr2("FEntryID") = ""
        dr2("FLastModifiedDate") = Nothing
    dr2("FUsed") = False
        Next
DataTables("test").DeleteFor("ID=\'" & dr1("ID") & "\'")
End If
Next


For Each dra1 As DataRow In DataTables("Pricelist").Select("[FNeg] = true ")
    If DataTables("test1").find("ID2=\'" & dra1("ID2") & "\'") Is Nothing Then
       If DataTables("ConfirmList").find("ID2=\'" & dra1("ID2") & "\'") Is Nothing Then      
       
       DataTables("ConfirmList").replacefor("FCurrencyID",dra1("FCurrencyID"),"ID2=\'" & dra1("ID2") & "\'")
      End If

DataTables("test1").DeleteFor("ID2=\'" & dra1("ID2") & "\'")
    End If
Next

--  作者:有点蓝
--  发布时间:2020/6/14 20:26:00
--  
For Each dr1 As DataRow In DataTables("Pricelist").Select("[FNeg] = true ")
If DataTables("test").find("ID=\'" & dr1("ID") & "\'") Is Nothing Then
    Dim dr2 As DataRow = DataTables("ConfirmList").AddNew()
    For i As Integer = 0 To Cols1.Length -1
        dr2(Cols2(i)) = dr1(Cols1(i))
        dr2("FEntryID") = ""
        dr2("FLastModifiedDate") = Nothing
    dr2("FUsed") = False
    Next
End If
else
DataTables("test").DeleteFor("ID=\'" & dr1("ID") & "\'")
Next