csv文件里有个16位数字1203120200000001 但是我读出来的确实用科学记数法表示的,怎么能转换成普通的数字?谢谢
- C# code
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的代码
------解决方案--------------------------------------------------------
- C# code
var number = "1.203E16"; decimal decstr = decimal.Parse(number.ToString(), System.Globalization.NumberStyles.Any);
------解决方案--------------------------------------------------------