如何取得Dataset中表table1的某字段的最大值,最小值,平均值,和等

时间:2021-05-28 19:16:32
object objSUM = this.yourds.Tables[0].Compute("SUM(yourcolumn)","");
object objAVG = this.yourds.Tables[0].Compute("AVG(yourcolumn)","");
object objMAX = this.yourds.Tables[0].Compute("MAX(yourcolumn)","");
object objMIN = this.yourds.Tables[0].Compute("MIN(yourcolumn)","");

decimal dSUM = Convert.ToDecimal("0"+objSUM .ToString());