gridview1:
       date          shipID   departmentID   worktypeID   actualHour_today    actualWeight_today
2008-4-5  0:00:00    200804        01           0101          23                   34
2008-4-10 0:00:00    200804        01           0101          11                   23
2008-4-15 0:00:00    200804        01           0101          33                   45
gridview2:
     year    month    shipID     departmentID    worktypeID  actualHour_current   actualWeight_current
    2008       4      200804           01          0101           67                    102计算结果存在table.stat中:
        date          shipID     departmentID    worktypeID  actualHour_current   actualWeight_current
 2008-4-1 0:00:00      200804           01          0101           67                    102
gridview1   是由collection的table根据date\shipID\departmentID\worktypeID查询得到的

解决方案 »

  1.   

    在绑定的时候得到DataSet或者DataTable然后看下面的代码··自己改吧
     double dd = 0;
                            double dh = 0;
                            DataTable tranDT=new DataTable ();
                            tranDT = BindDataWithSNToDataTable(DealOID.Value, out dd, out dh);
                            foreach (DataRow dr in dt2.Rows)
                            {
                                DataRow r = tranDT.NewRow();
                                r["TSN"]=dr["TSN"];
                                r["TOID"] = dr["TOID"];
                                r["POID"] = dr["POID"];
                                r["TSubTotal"] = dr["TSubTotal"];
                                r["TCheckScore"] = dr["TCheckScore"];
                                r["TLTotal"] = dr["TLTotal"];
                                r["PSN"] = dr["PSN"];
                                r["PCompanyName"] = dr["PCompanyName"];
                                r["PSubTotal"] = dr["PSubTotal"];
                                r["PDCheckScore"] = dr["PDCheckScore"];
                                r["PPCheckScore"] = dr["PPCheckScore"];
                                r["PLCheckScore"] = dr["PLCheckScore"];
                                r["PLTotal"] = dr["PLTotal"];
                                r["TPSN"] = dr["TPSN"];
                                r["PPSN"] = dr["PPSN"];
                                r["PCSN"] = dr["PCSN"];
                                tranDT.Rows.Add(r);
                            }
                            transD = 0;
                            deliverD = 0;
                            //dt2.Rows.CopyTo(tranDT.Rows, 0);
                            foreach (DataRow r  in tranDT.Rows )
                            {
                                if (r["TLTotal"].ToString () != null && r["TLTotal"].ToString () != "")
                                {
                                    transD = transD + Convert.ToDouble(r["TLTotal"]);
                                }
                                if (r["PLTotal"].ToString () != null && r["PLTotal"].ToString () != "")
                                {
                                    deliverD = deliverD + Convert.ToDouble(r["PLTotal"]);
                                }
                            }
                            TransportSignBillSummary.DataSource = tranDT;
                            TransportSignBillSummary.DataBind();
      

  2.   

    不是很明白……可能是我太菜了用lable和textbox解决了还是谢谢各位!!