Compute求当前页数据总和是这样用的,记住了

页面

								总金额: <%=dt.Compute("Sum(jexx)","") %>元
								合计:
		                        总金额: <%=dt.Compute("Sum(jexx)","") %>元
                                预付款: <%=dt.Compute("Sum(yufuk)","") %>元
                                已结清: <%=dt.Compute("Sum(jexx)","mystatus=3") %>元
                                    欠款: <%=decimal.Parse(dt.Compute("Sum(jexx)","").ToString())-decimal.Parse(dt.Compute("Sum(yufuk)","").ToString())-decimal.Parse(dt.Compute("Sum(jexx)","mystatus=3").ToString()) %>元  
                                 

后台

string sql = "o.KeyId mainKeyid,od.KeyId detKeyId,o.comname,o.jpm,o.orderid,od.yspmc,od.sl,od.dj,od.je,o.jexx,o.yufuk,o.dept,o.status,o.mystatus";//需要显示的字段
 dt = SqlEasy.ExecuteDataTable("Select * FROM (SELECT ROW_NUMBER()Over(order by o.KeyId desc) as rowId," + sql + " from jydOrder as o,jydOrderDetail as od where od.orderid=o.OrderID "+searchSql+") as mytable WHERE rowId between " + start + " and " + end + "");

你可能感兴趣的:(C#)