请求帮忙解决问题,如下所述,在线等待。。。。。。 汇总信息可在Table中的最后一个Td中用Label控件实现。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 PageLoad时用循环求和for(int i=0;i<....Tables[0].Rows.Count;i++)//DataSet中Rows的Count值{count=count+Convert.ToInt32(.....Tables[0].Rows[i]["表的列名字"].ToString()); }然后编辑模版列去Bind就可以了 <%# DataBinder.Eval....... %> to jjcccc():能否说得细一点。to camelials(陈祥):请说得仔细一点,最好能给出完整的源代码或者例子,谢谢两位。 你的结果集是DataSet话这样做:假设你的DataSet对象名为myDataSet:int intCount=0,intPrice=0;for(int i=0;i<myDataSet.Rows.Count;i++){ intCount+=myDataSet.Tables[0].Rows[i]["数量"]; intPrice+=myDataSet.Tables[0].Rows[i]["金额"];}DataRow newRow=new DataRow();newRow["名称"]="汇总";newRow["数量"]=intCount;newRow["金额"]=intPrice;myDataSet.Tables[0].Rows.Add(newRow);DataGrid.DataSource=myDataSet.Tables[0].DefaultView;DataGrid.DataBind(); 问题ADO.NET的问题 如何将二进制流映射成相应的文件对象 请问一个DataSet,DataTable问题[大小写],我给的分都比较高 小小的写字板关闭问题 DataGrid属性设置问题 有薪请教关于网站登录,内详! 我想从网页上提取一些数据,并把数据存入数据库!有兴趣的过来看一下! 问个可能比较实用的问题:可以把读取文件放在主程序文件里嘛? 如何禁止关闭窗体 C#是做什么的,好用吗,来者给分? 如何将Tue, 2 Sep 2003 11:40:37 +0800 这样的日期格式转换为2003-9-2 11:40:37? 如何知道一个实例变量已经实例化了!
for(int i=0;i<....Tables[0].Rows.Count;i++)//DataSet中Rows的Count值
{
count=count+Convert.ToInt32(.....Tables[0].Rows[i]["表的列名字"].ToString());
}
然后编辑模版列去Bind就可以了
<%# DataBinder.Eval....... %>
to camelials(陈祥):请说得仔细一点,最好能给出完整的源代码或者例子,谢谢两位。
假设你的DataSet对象名为myDataSet:int intCount=0,intPrice=0;
for(int i=0;i<myDataSet.Rows.Count;i++)
{
intCount+=myDataSet.Tables[0].Rows[i]["数量"];
intPrice+=myDataSet.Tables[0].Rows[i]["金额"];
}
DataRow newRow=new DataRow();
newRow["名称"]="汇总";
newRow["数量"]=intCount;
newRow["金额"]=intPrice;
myDataSet.Tables[0].Rows.Add(newRow);
DataGrid.DataSource=myDataSet.Tables[0].DefaultView;
DataGrid.DataBind();