从Excel中读取值时失去精度

我需要使用OleDb连接将值从Excel读取到DataSet。 以下是我的代码。

OleDbCommand excelCommand = new OleDbCommand(); OleDbDataAdapter excelDataAdapter = new OleDbDataAdapter(); string connectionString = @"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + filelocation + @";Extended Properties=""Excel 8.0; IMEX=1;HDR=NO;"""; OleDbConnection excelConn = new OleDbConnection(connectionString); excelConn.Open(); excelCommand = new OleDbCommand("SELECT * FROM [Sheet1$]", excelConn); excelDataAdapter.SelectCommand = excelCommand; excelDataAdapter.Fill(ds); 

读书的时候,我在细胞中失去了精确度。

例如:Excel单元格的值为-0.46256613817052

我的数据集有价值-0.4625661

Excel表格中的大部分单元格都是Numbertypes的。

如何解决这个问题? 请帮忙。

根据这个答案为Microsoft.Jet.OLEDB.4.0舍入excel数据? ,如果你需要得到确切的值,你需要使用Visual Studio工具的办公室。

我已经使用Excel Data Reader /