OleDbException: Too many fields defined.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I'm using an Excel-file generated by a third-part
application as input to my C# app. The problem occurs i
one of the worksheets in that Excel-file, where there i
a single column and no column name, so that the dat
starts in the second row

I'm connecting to the Excel-file as an OleDb-source
using an OleDbDataAdapter to fill a DataTable. I get a
OleDbException when I try to fill the DataTable. Th
exception message is 'Too many fields defined'. Doe
anyone know this message, and how to avoid it
 
Hi Sanjeev;

I had the same problem a while ago... I'm not sure why it is and I couldn't
find any documentation, but I'm guessing that it uses the first row to build
the columns collection and then afterward you have more data than columns.
The quick fix is to add some meaningless (or meaningfull ) column name
there. It's a kluge, but I don't know of any way around it .

HTH,

Bill
 
¤ Hi,
¤
¤ I'm using an Excel-file generated by a third-party
¤ application as input to my C# app. The problem occurs in
¤ one of the worksheets in that Excel-file, where there is
¤ a single column and no column name, so that the data
¤ starts in the second row.
¤
¤ I'm connecting to the Excel-file as an OleDb-source,
¤ using an OleDbDataAdapter to fill a DataTable. I get an
¤ OleDbException when I try to fill the DataTable. The
¤ exception message is 'Too many fields defined'. Does
¤ anyone know this message, and how to avoid it?

That error indicates that the query is attempting to retrieve data from 256 or more columns in the
Worksheet.


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
Back
Top