老师,如截图,可以优化一下代码,使其下载资料后,将列partno相同,在同一个月内的的iquantity 相加,加到表 rdrecords11中。谢谢。
Dim cmd As New SQLCommand
Dim dt As DataTable
DataTables("rdrecords11").datarows.clear
cmd.C
Dim Cols111() As String = {"cInvcode","iquantity","Dvdate"}
Dim Cols222() As String = {"PartNo","Qty","Date"}
cmd.CommandText ="Se/lect cInvcode,iquantity,dvdate From {rdrecords11} Where [dvDate] > = '" & e.Form.Controls("Datetimepicker1").Value & "' And [dvDate] < = '" & e.Form.Controls("Datetimepicker2").Value & "'"
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
Next