更新时间:2023-11-26 11:11:52
hi ...
我认为您可以通过2种方式做到这一点.
1)如果您使用sql server并使用存储过程,则
使用分组依据和汇总写查询,返回所需结果.
2)您可以创建结果集,例如
提取2个数据表,一个用于Distict日期,另一个用于带有详细信息的日期
hi...
I think you can do this in 2 ways.
1) If You use sql server and use Stored Procedure then
Write query with Group by and rollup which return your required result.
2) You can create result set like
Fetch 2 Datatable one for Distict Date and One for Date with Detail
//Create Temp Table
Datatable tmpdt=new Datatable();
//Add Data Columns in tmpdt.
//Loop For Date
for(i=0;i<dt.rows.count;i++)>
{
Decimal totAmt=0.0;
for(j=0;j<=dtDetail.rows.countj++)
{
if(dt.rows[i]["Date"]==dtDetail.rows[j]["Date"])
{
totAmt=totAmt+convert.toDecimal(dtDetail.rows[j]["Date"]);
}
}
Datarow dr;
dr=dttmp.NewRow();
//Add Detail
tmpdt.rows.add(dr);
}
//最后将数据源设置为grid
// Finally set data source to grid