tags:

views:

251

answers:

1

I am connecting to the excel file using ADO.NET OLeDB drivers. In the connection string I have HDR=NO ( which means my excel file does not have header)

I want to run update statement and refer to column as they are in excel file. The below sql query throws the following error : No value given for one or more required parameters.

update [fact$] set AC='test123' where DO='xxxyyy'

Here 'AC' and 'DO' are the respective columns on excel sheet 'fact'.

+2  A: 

As far as my quick research has found, the Jet engine assigns columns names starting with F, i.e. F1, F2, F3 etc.

You can do your own testing by creating an OleDataReader, then calling the GetSchemaTable() method to find out about your columns.

ck
thanks, i agree looks like F1 F2 F3... is the default pattern. It becomes quite a guess work if we have lots of columns in the workbook. It would have been great if the jet engine could accept the columns as they are in excel i.e A..Z,BA..BZ,CA..CZ,etc
dotnetcoder
might be wrong but i think you can create custom schema file for your data provider if you know beforehand what the columns look like.
Anonymous Type