csv文件里有个16位数字1203120200000001 但是我读出来的确实用科学记数法表示的,怎么能转换成普通的数字?谢谢            string fileName = FileUpload1.FileName;
            string fPath = Server.MapPath("\\") + "CardFile\\";//上传到服务器的文件夹路径
            if (Directory.Exists(fPath) == false)
            {
                Directory.CreateDirectory(fPath);
            }
            string filePath = fPath + fileName;//绝对路径
            FileUpload1.SaveAs(filePath);//上传至服务器            string strConn = string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties='text;HDR=Yes;FMT=Delimited';Data Source=" + fPath);
            OleDbConnection conn = new OleDbConnection(strConn);
            DataTable dt = new DataTable();
            string sqlStr = "select * from " + fileName;
            try
            {
                if (conn.State == ConnectionState.Closed)
                    conn.Open();
                OleDbDataAdapter dr = new OleDbDataAdapter(sqlStr, conn);
                DataSet ds = new DataSet();
                dr.Fill(ds, "mytable");
                dt = ds.Tables["mytable"];
            }
            catch
            { }
            finally
            {
                conn.Close();            }
            return dt;
这是读取CSV的代码

解决方案 »

  1.   


     var number = "1.203E16";
     decimal decstr = decimal.Parse(number.ToString(), System.Globalization.NumberStyles.Any);
      

  2.   


    csv里的值是1203120200000001,程序读取出来的是1.2031205E+15 ,怎么把这个科学记数法的数值转换回去?long.parse这个好像不行
      

  3.   

    其实你的程序从CSV里面读取的数据是准确的.你的问题是怎么样在调试时为用科学记数法显示.
    指定显示格式就可以了.
      

  4.   

    什么意思?转换出来 decstr 1203120500000000 decimal