以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]使用外部数据源代码 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=106946) |
-- 作者:heyufu038 -- 发布时间:2017/9/18 17:00:00 -- [求助]使用外部数据源代码 请问如下代码如果用外部数据源 代码怎么写? Dim idx As String = "-1," Dim idx_temp As String = "" Dim pdr As DataRow = Nothing Dim count As Integer = 0 Dim cs As String = "产品名称,产品规格" For Each dr As DataRow In DataTables("库存表").Select("", cs) Dim flag As Boolean = False If pdr IsNot Nothing Then For Each c As String In cs.split(",") If pdr(c) <> dr(c) Then flag = True Exit For End If Next End If If flag Then If count > 1 Then idx &= idx_temp End If count = 1 idx_temp = "" Else count += 1 idx_temp &= dr("_Identify") & "," End If pdr = dr Next If count > 1 Then idx &= idx_temp End If Tables("库存表").filter = "_Identify not in (" & idx.trim(",") & ")"
|
-- 作者:有点甜 -- 发布时间:2017/9/18 17:44:00 -- 不论是外部数据源还是内部数据源,只要你把库存表的数据加载进来,代码都不用改。
你现在遇到什么问题了? |
-- 作者:heyufu038 -- 发布时间:2017/9/18 19:21:00 -- http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&replyID=730897&ID=106903&skin=1 其实就是这个问题我看了列子 无法实现我的目的 没办法我用笨办法 做了个按钮 代码 DataTables("库存表").DeleteFor("") Dim h As New Filler h.SourceTable = DataTables("订单明细") \'指定数据来源 h.SourceCols = "产品编号,产品名称,产品规格"
\'指定数据来源列 h.DataTable = DataTables("库存表") \'指定数据接收表 h.DataCols = "产品编号,产品名称,产品规格"
\'指定数据接收列 h.Fill() \'填充数据
Dim idx As
String = "-1," Dim idx_temp As
String = "" Dim pdr As
DataRow = Nothing Dim count As
Integer = 0 Dim cs As String = "产品名称,产品规格" For Each dr
As DataRow In DataTables("库存表").Select("", cs) Dim flag As Boolean = False If
pdr IsNot Nothing Then For Each c As String In cs.split(",") If pdr(c) <> dr(c) Then flag = True Exit For End If Next End If If flag Then If count > 1 Then idx &= idx_temp End If count = 1 idx_temp = "" Else count += 1 idx_temp &= dr("_Identify")
& "," End If pdr = dr Next If count
> 1 Then idx &=
idx_temp End If Tables("库存表").filter = "_Identify
not in (" & idx.trim(",") &
")" 然后采购表项目 代码 If e.DataCol.Name = "数量" Then Dim pr As DataRow pr = DataTables("库存表").Find("产品名称 = \'"
& e.DataRow("产品名称")
& "\' And 产品规格 = \'"
& e.DataRow("产品规格")
& "\'") If pr IsNot Nothing Then pr("数量")= pr("数量") + e.NewValue - e.OldValue End If
End If 结果数量 统计不出来 请大神帮我看下 代码怎么写 [此贴子已经被作者于2017/9/18 19:23:20编辑过]
|
-- 作者:heyufu038 -- 发布时间:2017/9/18 19:22:00 -- 看列子无法实现我的目的 用笨办法做了这么个按钮 |
-- 作者:有点蓝 -- 发布时间:2017/9/18 20:15:00 -- 具体请上传实例测试 |