0

I want to read excel to datatable.But I have a problem.I have a column "ALS" which contains mixed type data.When I read excel to dataset "Kukla" is DbNul value instead.I cant read such columns all datas

example, column data: 2000 Kukla 2000 1000 1000

String sConnectionString =
                    "Provider=Microsoft.Jet.OLEDB.4.0;" +
                    "Data Source=" + "C:\\DrcrUpload\\" + filePath + ";" +
                    "Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=1\"";
            OleDbConnection objConn;
            objConn = new OleDbConnection(sConnectionString);

 OleDbCommand objCmdSelect = new OleDbCommand("SELECT * FROM" + "[" + name + "]", objConn);

objAdapter1.Fill(objDataset1);
Ali Sheikhpour
  • 10,475
  • 5
  • 41
  • 82
ozman
  • 256
  • 1
  • 4
  • 18
  • Possible duplicate? http://stackoverflow.com/questions/3232281/oledb-mixed-excel-datatypes-missing-data – Mathias May 14 '11 at 19:16

1 Answers1

0

You have a few options

1.Change the registry setting TypeGuessRows = 0

2.List all possible type variations in the first 8 rows as 'dummy data' (eg memo fields/nchar(max)/ errors #N/A etc)

This thread may help also Link

Community
  • 1
  • 1