以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [原创]:求助 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=123624) |
||||
-- 作者:xu84988 -- 发布时间:2018/8/19 17:58:00 -- [原创]:求助 Dim r As Row = Tables("分期付款").Current If r IsNot Nothing Dim Filter As String = "业务编号 = \'" & r("业务编号") &"\'" Dim lst As new List(of DataRow) Dim names() As String = {"分期明细","费用明细"} For Each Name As String In names Dim drs As new List(of DataRow) drs = DataTables(Name).Select(Filter) For Each dr As DataRow In drs lst.Add(dr) Next Next 请问 : lst 集合是按照单个表的数据排序的,这个集合中
有一个 "交易日期" 的字段,求助要怎么写代码可以
让集合中的记录按‘交易日期‘ 排序? DataTables("支出明细").DeleteFor(Filter) For Each mr As DataRow In lst Dim pr As DataRow = DataTables("支出明细").AddNew For Each cl As Col In Tables("支出明细").Cols pr(cl.Name) = mr(cl.Name) Next Next Tables("支出明细").Save e.form.Close End If
|
||||
-- 作者:有点蓝 -- 发布时间:2018/8/19 18:07:00 -- drs = DataTables(Name).Select(Filter,"交易日期") |
||||
-- 作者:xu84988 -- 发布时间:2018/8/19 18:16:00 -- 我试过了,还是不可以 |
||||
-- 作者:有点蓝 -- 发布时间:2018/8/19 20:22:00 -- 肯定不会有问题。请上传实例说明 |
||||
-- 作者:xu84988 -- 发布时间:2018/8/21 3:53:00 -- 已经上传了
|
||||
-- 作者:有点蓝 -- 发布时间:2018/8/21 8:53:00 -- Dim r As Row = Tables("分期付款").Current If r IsNot Nothing Dim Filter As String = "业务编号 = \'" & r("业务编号") &"\'" Dim sql As String = "select * from (select 交易日期,账户编号,账户名称,业务名称,交易金额,对象编号,对象名称,出账,账单编号,业务编号,审核,备注,交易方式,出账日期 from {分期明细} where " & Filter sql &= " union all select 交易日期,账户编号,账户名称,业务名称,交易金额,对象编号,对象名称,出账,账单编号,业务编号,审核,备注,交易方式,出账日期 from {费用明细} where " & Filter & ") As a order by 交易日期" Dim cmd As new SQLCommand cmd.CommandText = sql Dim dt As DataTable = cmd.ExecuteReader() DataTables("支出明细").DataRows.Clear For Each mr As DataRow In dt.DataRows Dim pr As DataRow = DataTables("支出明细").AddNew For Each cl As Col In Tables("支出明细").Cols If pr.DataTable.DataCols.Contains(cl.Name) pr(cl.Name) = mr(cl.Name) End If Next Next End If
|
||||
-- 作者:xu84988 -- 发布时间:2018/8/22 12:14:00 -- 谢谢,已解决!! |