ConnectionString:
ConStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + dynParams.FilterLink +
";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=1\"";
var Sheets = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
string sht = dynParams.FilterName;//(from DataRow dr in Sheets.Rows select dr[2].ToString().Replace("'", "")).FirstOrDefault();
var query = "SELECT * FROM [" + sht + "]";
var cmd = new OleDbCommand(query, conn);
// create a data adapter and get the data into dataadapter
var da = new OleDbDataAdapter(cmd);
var ds = new DataSet();
//fill the Excel data to data set
da.Fill(ds);
Excel data:
01.09.2020
01.09.2006
07.02.2011
14.02.2004
27.12.2017
13.10.2017
25.09.2018
01.07.2020
06.02.2012
05.12.2017
02.08.2018
19.02.2019
08.10.2014
13.06.2016
02.05.2019
05.09.2017
07.10.2005
20.05.2013
28.01.2008
Returned data:
01/09/2020
01/09/2006
07.02.2011
14.02.2004
27.12.2017
13.10.2017
25.09.2018
01.07.2020
06/02/2012
05.12.2017
02.08.2018
19.02.2019
08.10.2014
13.06.2016
02.05.2019
05/09/2017
07/10/2005
20.05.2013
28.01.2008
It is possible that the date format is not the same and the format comes in mm / dd / yyyy. When I did some research, it was written that the IMEX = 1 field should be changed, but although I tried this, I could not get any results.