以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 代码合并 简化 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=113385) |
-- 作者:yifan3429 -- 发布时间:2018/1/15 9:07:00 -- 代码合并 简化 If e.Table.Current IsNot Nothing Then Dim Filter As String = "订单ID = \'" & e.Table.Current("订单ID") & "\'" DataTables("附件管理").RemoveFor(Filter) DataTables("附件管理").AppendLoad(Filter) \'则追载此订单的订单明细 End If If e.Table.Current IsNot Nothing Then Dim Filter As String = "订单ID = \'" & e.Table.Current("订单ID") & "\'" DataTables("订单清单").RemoveFor(Filter) DataTables("订单清单").AppendLoad(Filter) \'则追载此订单的订单明细 End If If e.Table.Current IsNot Nothing Then Dim Filter As String = "订单ID = \'" & e.Table.Current("订单ID") & "\'" DataTables("执行团队").RemoveFor(Filter) DataTables("执行团队").AppendLoad(Filter) \'则追载此订单的订单明细 End If If e.Table.Current IsNot Nothing Then Dim Filter As String = "订单ID = \'" & e.Table.Current("订单ID") & "\'" DataTables("项目备忘录").RemoveFor(Filter) DataTables("项目备忘录").AppendLoad(Filter) \'则追载此订单的订单明细 End If 大量重复的代码 怎样简化下
[此贴子已经被作者于2018/1/15 9:07:34编辑过]
|
-- 作者:有点甜 -- 发布时间:2018/1/15 9:09:00 -- If e.Table.Current IsNot Nothing Then Dim Filter As String = "订单ID = \'" & e.Table.Current("订单ID") & "\'" Dim ary() = {"附件管理","订单清单","执行团队","项目备忘录"} For Each s As String In ary If DataTables(s).Find(Filter) Is Nothing Then \'如果对应的订单明细没有加载过 DataTables(s).AppendLoad(Filter) \'则追载此订单的订单明细 End If Next End If |