Excel data numeric type read problem

F

free9645

Hi guys,

I use Oledb driver read content from a excel spread sheet to my
dataset . I have a column in excel file contains only numbers (no
mixed type). The problem is that if the number is very long, like
1234567.1, there is a chance I get something like 1234567.1000001 in
dataset. But for shorter number, it is all fine.

I am using .net framework 1.1. The code is like this:

string connString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;
DATA SOURCE='t.xls';Extended Properties=\"Excel 8.0;HDR=1;IMEX=1\"";
OleDbConnection myConn = new OleDbConnection(connString);
OleDbDataAdapter adapter = new OleDbDataAdapter("select *
from [sheet1$]", myConn);
DataSet ds = new DataSet();
adapter.Fill(ds);

Please help. Thanks in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top