Rookie here... I need to get the column name from an excel file so I can use it as a string. I'm using C# with OLEDB.
private void CheckFiles();
{
OleDbConnection MyConnection;
DataSet DtSet;
OleDbDataAdapter MyCommand;
string file = @"C:\Users\...path...\2015.xlsm";
MyConnection = new OleDbConnection(@"provider=Microsoft.ACE.OLEDB.12.0;Data Source='" +
file + "';Extended Properties=Excel 8.0;");
MyCommand = new OleDbDataAdapter("Select * from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = " +
tab, MyConnection);
MyConnection.Open();
MyCommand.TableMappings.Add("Table", "Net-informations.com");
MyConnection.Close();
}
Thanks in advance!
C#withOLEDBnow show us what you have thus far so that we can help or someone else can lend you more advice. post your code showing us what you have tired...Fillmethod to execute the OleDbAdapter sql command.. I will post an example on how I just tested excel on my own machine using JetProvider