以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助] 直接读取数量 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=176179) |
-- 作者:leoli -- 发布时间:2022/4/2 17:36:00 -- [求助] 直接读取数量 老师,以下代码是从后台数据库rdrecords11直接下载到foxtable表rdrecords11中。 那如何直接在表rdrecords11的表属性中,直接从后台汇总表rdrecords11中,当在rdrecords11产品名全部列出来后,谢谢。 Dim cmd As New SQLCommand Dim dt As DataTable DataTables("rdrecords11").datarows.clear cmd.Con nection Name = "axalta" Dim Cols111() As String = {"cInvcode","iquantity"} Dim Cols222() As String = {"PartNo","Qty"} cmd.CommandText ="se /lect cInvcode,年,月,sum(iquantity) as iquantity from (Se lect cInvcode,iquantity,year(ddate) as 年,month(ddate) as 月 From ({rdrecord11} Inner JOIN {rdrecords11} ON {rdrecords11}.[ID] = {rdrecord11}.[ID]) Where [dDate] > = \'" & e.Form.Controls("Datetimepicker1").Value & "\' And [dDate] < = \'" & e.Form.Controls("Datetimepicker2").Value & "\') as a group by cInvcode,年,月" dt = cmd.ExecuteReader() For Each dr1 As DataRow In dt.DataRows Dim dr2 As DataRow = DataTables("rdrecords11").AddNew() For i As Integer = 0 To Cols111.Length -1 dr2(Cols222(i)) = dr1(Cols111(i)) Next dr2("date") = new Date(dr1("年"),dr1("月"),1) Next |
-- 作者:有点蓝 -- 发布时间:2022/4/2 17:41:00 -- 没看懂想表达的什么意思? |