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

时间:2022-09-15 15:11:15
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());