tags:

views:

604

answers:

1

Hi

I am Using OLEDB to read Excel Sheet with C#. In that Column header Name is "Sr.No." in my "Sheet1". When i fetch Excel Sheet Data into my Datatable , i am getting "Sr#No#" as a column header name instead of original one. Can you please tell me why it’s happening so? And what is the solution for the same.

Thanks.

A: 

Googling around suggests that this is an inherent feature of OLEDB, rather than being anything to do with Excel - it seems to simply not like periods (.) in column names.

My suggestions would be either to cope with it - it seems to be a deterministic replacement of .s with #s - or if possible use an alternative means of reading Excel data from C# (search this site for alternatives).

AakashM