简化一下吧:
Dim T,gs,Ln,Ls() As String
Dim dr As DataRow = e.DataRow
T = "[清单内容] = '" & dr("清单编号") & "'"
Ln = "田家屋场大桥,向家梁子大桥,牛王庙大桥,易家屋场大桥,月亮山大桥"
Ln = Ln & ",K28540天桥,K29360天桥,K28312涵洞,K28605涵洞,K29580涵洞,增减数量"
Ls = Ln.split(",")
If e.DataCol.name="清单编号" then
For Each Ln In Ls
if Ln.Indexof("天桥") > 0 orelse Ln.Indexof("涵洞") > 0 then
T = T & " and [单位工程名称] = '" & Ln.Insert(3,"+") & "'"
T = T.Replace("天桥","车行天桥").Replace("涵洞","钢筋砼盖板涵")
End if
if Ln <> "增减数量" then
Ln = Ln & "_变更后数量"
gs = "Sum(变更后数量)"
else
gs ="Sum(增减数量)"
end if
dr(Ln) = DataTables("台帐").Compute(gs,T)
Next
end if
[此贴子已经被作者于2009-4-2 16:00:51编辑过]