我繼承了另一位開發者在vb.net編寫的應用程序(我仍然不太流利)。它包含一個數據綁定的GridView,它也動態地生成列的標籤。例如,我需要將學年標題更改爲2009-2010,而不僅僅是2010年。目前的代碼爲標題設置了學年,但它似乎也控制着顯示的數據。如何更改DataBound GridView上的標籤?
下面是代碼:
sql_string_Total = sql_string_Total & " sum([" & Academic_year - 4 & "]) as [" & Academic_year - 4 & "],sum([" & Academic_year - 3 & "]) as [" & Academic_year - 3 & "],sum([" & Academic_year - 2 & "]) as [" & Academic_year - 2 & "],sum([" & Academic_year - 1 & "]) as [" & Academic_year - 1 & "],sum([" & Academic_year & "]) as [" & Academic_year & "], "
sql_string_Total = sql_string_Total & " sum([" & Academic_year & "]-[" & Academic_year - 1 & "]) as [" & (Academic_year - 1) & "-" & (Academic_year) & " Diff.], "
sql_string_Total = sql_string_Total & " (cast(((sum([" & Academic_year & "])-sum([" & Academic_year - 1 & "]))/(sum([" & Academic_year - 1 & "])*1.0)*100.0)as numeric(4,1))) as [" & (Academic_year - 1) & "-" & (Academic_year) & " % Change] "
我怎樣才能改變這些的cols的標題,而不會影響顯示的數據?