向datatable中添加列,可以指定类似于sql server中numnic可以指定小数位数的类型么

解决方案 »

  1.   

    DataTable table = new DataTable();
    DataColumn c = new DataColumn("A",Type.GetType("System.Double"));
    table.Columns.Add(c);
      

  2.   


                DataTable dt = new DataTable();
                dt.Columns.Add("Num", typeof(System.Decimal));
        
      

  3.   

    C#没有直接定位小数点的类型,你可以对结果进行ROUND
    Math.Round,DECIMAL类也有ROUND
      

  4.   

    就是不想用round,才问该问题