I'm using OleDbDataAdapter
I'm trying to get data from excel to DataTable, Here is my code;
var conn = new OleDbConnection(strConn);
var myCommand = new OleDbDataAdapter(" SELECT * FROM [UPLOADFILE$] ", strConn);
var inputTable = new DataTable();
try
{
myCommand.Fill(inputTable);
}
Here is my Conn Str;
"Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=" + "MyPath" + ";" +
"Extended Properties=\"Excel 8.0;IMEX=1;TypeGuessRows=0;ImportMixedTypes=Text\"";
Somehow, It eliminates the strings starting with "0", but others are okay.
I used the following combinations, as well;
"Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=" + "MyPath" + ";" +
"Extended Properties=\"Excel 8.0;IMEX=0;TypeGuessRows=0;ImportMixedTypes=Text\"";
"Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=" + "MyPath" + ";" +
"Extended Properties=\"Excel 8.0;HDR=No;IMEX=1;TypeGuessRows=0;ImportMixedTypes=Text\"";
"Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=" + "MyPath" + ";" +
"Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=1;TypeGuessRows=0;ImportMixedTypes=Text\"";
Thanks in advance!
My Tries;
Excel 8.0;HDR=No;IMEX=1;