以文本方式查看主题 - 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=120998) |
-- 作者:ZJZK2018 -- 发布时间:2018/6/27 15:08:00 -- 求交集代码出错 二个表根据“项目编号”找查出相同数据,表A中是多行或单行,表B中“中标单位”列为多值列, 下面代码出错: Dim dr As DataRow = Tables("表B").Current.DataRow Dim Lis1 As New List(of String) For Each nn As String In dr("中标单位").split(",") If lis1.Contains(nn) = False Then lis1.Add(nn) End If Next Dim str1 As String = lis1 str1 = str1.Replace("|","\',\'") Dim lis2 As New List(of String) lis2 = DataTables("表A").GetValues("投标单位","项目编号 = \'" & dr("项目编号") & "\' and 投标单位 in (\'" & str1 & "\')") Dim str As String = String.Join("|",lis2.ToArray) msgbox(str) |
-- 作者:有点甜 -- 发布时间:2018/6/27 15:18:00 -- Dim dr As DataRow = Tables("表B").Current.DataRow Dim str1 = dr("中标单位").Replace(",","\',\'") Dim lis2 As New List(of String) lis2 = DataTables("表A").GetValues("投标单位","项目编号 = \'" & dr("项目编号") & "\' and 投标单位 in (\'" & str1 & "\')") Dim str As String = String.Join("|",lis2.ToArray) msgbox(str) |