I'm using following code to connect with a Excel file with OleDB:
Connection = New System.Data.OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + Path + ";Extended Properties=Excel 12.0;")
Command = New System.Data.OleDb.OleDbDataAdapter("select * from [Sheet1$]", Connection)
DataSet = New System.Data.DataSet
Command.Fill(DataSet)
Connection.Close()
I would like to get the name of the first excel sheet and put it in a string variable so I can use it in the SQL command. How can I do this?