数字排序在构造DataTable时候需要指明类型,否则会按字符串排序:


指明类型:

     DataTable dt = new DataTable();

          dt.Columns.Add("qymc", typeof(string));

            dt.Columns.Add("fs",typeof(decimal));

            dt.Columns.Add("fq", typeof(decimal));

            dt.Columns.Add("gt", typeof(decimal));


降序排序:

   

        DataView dv = new DataView(dt);

            dv.Sort = "FS DESC";

 NameValue = new List<string>() ;

             Values = new List<decimal?>();

            int up = 0;

获取排序值:

            foreach(DataRowView drv in dv)

            {

               string name=drv["qymc"].ToString();

               decimal fs=decimal.Parse(drv["fs"].ToString());

}