''' Dim Da As DataTable = DataTables("表2") DataTables("另表").DataRows.Clear() Dim TS,T As String dim i,i1,sum,rs as Integer For i = 1 to 6 For Each dr As DataRow in Da.Select("姓名" & i & ">''") If Ts Is Nothing OrElse Ts.Indexof(dr("姓名" & i )) = -1 Then Ts = Ts & "," & dr("姓名" & i ) End If Next Next rs = Ts.substring(1).split(",").Length Tables("另表").Addnew(rs) For i = 0 to rs-1 T = Ts.substring(1).split(",")(i) Tables("另表").rows(i)("姓名")=T sum=0 for i1 =1 to 6 sum =sum+Da.Compute("Sum(数量" & i1 & ")","姓名" & i1 & "='" & T & "'") Next Tables("另表").rows(i)("数量") = SUm Next
|