求一个在C#中合计动态列行的值给新创建的列行中显示
zhlym 2007-03-19 04:17:00 求一个在C#中合计动态列行的值给新创建的列行中显示
...前面DataSet部分略去不写
for (int i = 0; i < ms.Length; i++)
{
mser = ms[i].Split('#');
BoundField bf1 = new BoundField();
bf1.HeaderText = "销量";
bf1.DataField = "a" + mser[0];
this.GridView1.Columns.Add(bf2);
}
BoundField bf3 = new BoundField();
bf3.HeaderText = "销量合计";
bf3.DataField = "";
this.GridView1.Columns.Add(bf3);
this.GridView1.DataSource = ds.Tables[0].DefaultView;
this.GridView1.DataBind();
说明:如上代码 "a" + mser[0] 是配合数据库中动态的字段名,现在想把每行的销量值合计显在新创建的列“销量合计”中,(由于某种原因这个合计不能在存储过程里做)请大家出下手