locked
storing data into DataSet from excel file using Oledb provider RRS feed

  • Question

  • User-1095265126 posted

    I'm stroing data into DataSet from excel file using Oledb provider in asp.net c# application.

    query: SELECT * FROM [Sheet1$]

    everything is working fine but my concern is that 1st row should be skiped and 2nd row should be used for heading and rest for datarow.

    I need help on urgent basis.

    thanks

    Thursday, April 7, 2011 3:05 AM

Answers

  • User1699702733 posted

    Hi Harry

    All you need is to add an "HDR=Yes" part to the extended properties of the connection string that you are using to open the excel file

    for example:

    OLEDB;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\MyExcel.xls;Extended Properties="Excel 8.0;HDR=Yes"

    "HDR=Yes;" indicates that the first row contains columnnames, not data. "HDR=No;" indicates the opposite and returns the first row as data.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, April 10, 2011 5:24 PM