문제

I have wrote a winform application that can open and read from a sheet of an excel file.I have used OleDbDataAdapter to read data and then set the data to a datatable. but my problem is that in this datatable the first row of data is used as the name of the columns however i want to use the base names that excel defines for each column (I mean "A B C ... AA AB ..." and so on).

도움이 되었습니까?

해결책

Take a look at this answer Importing Excel data into C# without first row becoming column names?

It seems you need to change the connection string Extended Properties=\"Excel 8.0;HDR=No;IMEX=1;\" and make sure HDR=No is set.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top