以文本方式查看主题

-  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=76215)

--  作者:jinzhengbe
--  发布时间:2015/10/23 20:56:00
--  这段代码应该怎么改,才能不重复复制已有的数据呢?
    For Each ro As Row In Tables("qt").rows
    Dim dr As DataRow = DataTables("quhuo").SQLFind("cord = \'" & ro("cord") & "\'")
    If dr IsNot Nothing Then
    MessageBox.Show("数据汇总表中已经存在 ")
     Return
ElseIf dr Is Nothing Then
Dim Cols1() As String = {"name","shangcheng","总未送数量","danhao","cord","time"}
Dim Cols2() As String = {"name","shangcheng","shuliang","danhao","cord","time"}
For Each dr1 As DataRow In DataTables("qt").Select("[状态] =\'未送\'")
Dim dr2 As DataRow = DataTables("quhuo").AddNew()
For i As Integer = 0 To Cols1.Length -1
dr2(Cols2(i)) = dr1(Cols1(i))
Next
Next
End If
Next

 

 

想把 qt 表的数据 复制到 quhuo表

 

    如果quhuo表里已经有 相同的cord值 就跳过  继续复制其他行到 quhuo表

 

现在的问题是 qt表的 第一行如果 在quhuo表 有相同的值, 后面的行全部放弃拷贝,应该怎么处理?

 

非常感谢!!!!

 

 

 

 


--  作者:ericsky
--  发布时间:2015/10/23 21:27:00
--  
试试把 return 去掉,return会停止后面的代码执行