我使用負載下面的代碼SQL表值到數據表下添加特定列一列數據表
DataTable dt = new DataTable();
SqlConnection con = new SqlConnection("Connection String Here");
con.Open();
SqlCommand cmd = new SqlCommand("select * from ExportExcel", con);
dt.Load(cmd.ExecuteReader());
int total = 0;
foreach (DataRow row in dt.Rows)
{
int salaryvalue = Convert.ToInt32(row["Salary"]);
total = salaryvalue + total;
}
dt.Rows.Add("Salary");
dt.Rows.Add(total);
我加工資,總dynamically.But它通過一個顯示在首列的一個。
但我需要在系列的工資,並在總薪酬Column.How做到這一點?
呵呵..太逗了,或者真的很難過,那些可以很容易地回答的問題(通過查找msdn)總能得到很多答案,而那些難以回答的問題會因爲他們沒有得分/分鐘而受到影響。 – Mithon