Dim pzbdt As DataTable = DataTable(“表a”)
Dim mxkm As new List(of String)
mxkm = pzbdt.GetValues("pzzb7","pzzb12 in (" & "测试" & ")" & " And (pzzb33 Is not null Or pzzb34 Is not null)")
For Each mx As String In mxkm '-----循环次数约3000-10000次
Dim hbzjlsb As String '---------SQL查询字符串------
hbzjlsb = "pzzb7,pzzb33,pzzb34,pzzb26,pzzb31 from {" & "dtpzzb" & "} where " & "pzzb7 In (" & mx & ")" & " And pzzb1 = '" & zgsztzz & "' and pzzb2 = '" & zgsztnd & "' and pzzb3 = '" & yfcs & "' and pzzb4 = '" & zgsztmc & "'and pzzb42 = '原'"
Dim pzbtjb As DataTable '---------分组统计表
Dim g As New GroupTableBuilder("统计表1",hbzjlsb,zgsconn)
g.Groups.AddDef("tjbh")
g.Groups.AddDef("pzzb26")
g.Groups.AddDef("pzzb31")
g.Groups.AddDef("pzzb7")
g.Totals.AddDef("pzzb33")
g.Totals.AddDef("pzzb34")
pzbtjb = g.Build(True)
For Each r As DataRow In pzbtjb.DataRows
If r("pzzb33") > r("pzzb34") Then
r("pzzb33") = r("pzzb33") - r("pzzb34")
r("pzzb34") = Nothing
ElseIf r("pzzb33") < r("pzzb34") Then
r("pzzb34") = r("pzzb34") - r("pzzb33")
r("pzzb33") = Nothing
ElseIf r("pzzb33") = r("pzzb34") Then
r("pzzb33") = Nothing
r("pzzb34") = Nothing
r.Delete
End If
'-----以下还有很多根据此表的逻辑判断与计算
Next
Next