OleDb Excel: no value for one or more required parameters
I am trying to extract some data from an excel file, the problem is I was reading the first line as data, so I decided to change the HDR in my connectionString to Yes, but after that my program ends up with the exception given in the topic title.
Here is my code and my request:
Call:
DataTable dt = Utils.queryXlsFile(Qry, dbConnection);
QueryXlsFile method:
public static DataTable queryXlsFile(String query, OleDbConnection dbConnection)
{
OleDbDataAdapter dbCommand = new OleDbDataAdapter(query, dbConnection);
DataTable dt = new DataTable();
dbCommand.Fill(dt);
return dt;
}
And my request:
select top 10 * FROM [PERSONNE$] WHERE (((([F1] LIKE '% prénom %') OR ([F1] LIKE '% prénom')) OR ([F1] LIKE '%-prénom')))
My connection string seems to be good as I can open a file connection.
Thanks in advance for your help.
+3
source to share