1

I have a function to get excel sheet column names.

 DataTable dt = excelConnection.GetOleDbSchemaTable(OleDbSchemaGuid.Columns, new object[] { null, null,"BOLT$" , null });

   foreach (DataRow row in dt.Rows)
   {
       MessageBox.Show((string)row["COLUMN_NAME"]);
   }             

But this function is getting column names as F1, F2 .. whereas my actual column headers are LineNo, DateOfPurchase ...

Arjun
  • 1,049
  • 6
  • 23
  • 37
  • 1
    http://stackoverflow.com/questions/832001/in-c-sharp-how-to-access-excel-headers-using-oledb-without-automation –  May 16 '13 at 10:41
  • @hob thank you. I got the issue. Problem was with connection string. HDR is set to NO earlier. Now I changed it to HDR=YES. everything works fine. – Arjun May 16 '13 at 11:07
  • great glad to be of help :) –  May 16 '13 at 11:08

0 Answers0