以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]加载数据  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=86625)

--  作者:WUZHAN
--  发布时间:2016/6/22 0:12:00
--  [求助]加载数据

在 表A(内部表) 中有 单号 列,想提取 单号列 中的不重复的单号,表B为SQL 数据表,加载表A 相同单号的 数据。以下代码帮忙看看。

Dim ids As String
For Each dr1 As DataRow In DataTables("表A").DataRows
   ids = ids & "," & dr1("单号")
Next
   ids= ids.Trim(",")
DataTables("表B").LoadFilter = "单号 In (" & ids & ")"
DataTables("表B").Load()


--  作者:Hyphen
--  发布时间:2016/6/22 8:27:00
--  
Dim Products As List(Of String) = DataTables("表A").GetValues("单号")

DataTables("表B").LoadFilter = "单号 In (\'" & String.Join("\',\'",Products.ToArray) & "\')"
DataTables("表B").Load()