Reputation: 195
We are importing some data from an Excel file into SQL. For this we are reading Excel file using OleDbDataAdapter. We want to read filtered data of rows where there is some value in specific columns. We have written a query like following:
SELECT * FROM [Sheet1$] WHERE [F6] IS NOT NULL OR [F7] IS NOT NULL OR [F8] IS NOT NULL OR [F9] IS NOT NULL OR [F10] IS NOT NULL OR [F11] IS NOT NULL OR [F12] IS NOT NULL OR [F13] IS NOT NULL
This query works on some files, on some other files it gives an error saying - No value given for one or more required parameters.
I have tried several combinations but it is not working. Any help would be appreciated.
Thanks, Rahul Jain
Upvotes: 0
Views: 73
Reputation: 195
I am able to solve it by including HDR=No in the connection string. Files which were not working had some values in first row.
Thanks everyone, Rahul
Upvotes: 1