以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  提取多列不重得值代码出错  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=119987)

--  作者:ZJZK2018
--  发布时间:2018/6/5 11:49:00
--  提取多列不重得值代码出错
老师你好:
表A与表B必须判断三列数据,前面AA|BB列的名称是一样的,第三个列名表A为CC,表B为DDD,如何处理下面
这段代码?谢谢!

Dim Arys As List(Of String())

Arys = DataTables("A").GetValues("AA|BB|CC")

For Each Ary As String() In Arys  

    Output.Show(Ary(0) & "|" & Ary(1) & "|" & Ary(2))

    Dim fil As String = "AA = \'" & Ary(0) & "\' and  BB = # " & Ary(1) & " # And CC = \'" & Ary(2) & "\'"

    Dim fdr As DataRow = DataTables("B").Find(fil)

    If fdr Is Nothing Then

        fdr = DataTables("B").AddNew()

        fdr("AA") = Ary(0)

        fdr("BB") = Ary(1)

        fdr("DDD") = Ary(2)

End If

Next


--  作者:有点甜
--  发布时间:2018/6/5 12:01:00
--  

Dim fil As String = "AA = \'" & Ary(0) & "\' and  BB = # " & Ary(1) & " # And CC = \'" & Ary(2) & "\'"

 

改成

 

Dim fil As String = "AA = \'" & Ary(0) & "\' and  BB = # " & Ary(1) & " # And DDD = \'" & Ary(2) & "\'"