以下是引用hhbb在2011-6-22 17:17:00的发言:
这样是否没这么烦:
Dim Ls As New List(Of String)
Ls.Add("Convert(([总版数_今年]/[总版数_去年]-1)*10000,'System.Int64')/10000")
Ls.Add("Convert([总版数_今年]/[出版天数_今年] ,'System.Int32')")
Ls.Add("Convert([总版数_去年]/[出版天数_去年],'System.Int32')")
Ls.Add("Convert([总版数_今年]/[出版天数_今年]-[总版数_去年]/[出版天数_去年],'System.Int32')")
Ls.Add("Convert([广告面积_今年]/[总面积_今年]*10000,'System.Int64')/10000")
Ls.Add("Convert([广告面积_去年]/[总面积_去年]*10000,'System.Int64')/10000")
Ls.Add("Convert(([广告面积_今年]/[总面积_今年]-[广告面积_去年]/[总面积_去年])*10000,'System.Int64')/10000")
Ls.Add("Convert(([广告占版数_今年]/[广告占版数_去年]-1])*10000,'System.Int64')/10000")
Ls.Add("Convert(([广告推算数_今年]/[广告推算数_去年]-1])*10000,'System.Int64')/10000")
Dim v1() As String = {"总版数_同比增幅","日均版数_今年","日均版数_去年","日均增幅数_去年","广告占版率_今年"}
Dim v2() As String = {"广告占版率_去年","广告占版率_变动数","广告占版率_同比增幅","广告推算额_同比增幅"}
Dim Ls1 As New List(Of String)
Ls1.AddRange(v1)
Ls1.AddRange(v2)
Dim t = Tables("窗口1_Table1")
Dim s As String
For n as Integer = 0 to ls.Count-1
s = "IIF(" & Ls(n) & "=0,Null," & Ls(n) & ")"
t.DataTable.DataCols.Add(Ls1(n),Gettype(Double),s)
Next
[此贴子已经被作者于2011-6-22 17:17:43编辑过]
不错···学习了。 “] ” 这个多余了。