when I'm trying to extract data table from excel file like this:
public void CopyTable(string filename)
{
var connectionString = string.Format("Provider=Microsoft.Jet.OLEDB.4.0; data source={0}; Extended Properties=Excel 8.0;", filename);
var adapter = new OleDbDataAdapter("SELECT col_1, col_2, col_3, col_4, col_5, col_6 FROM[Sheet1$]", connectionString);
var ds = new DataSet();
adapter.Fill(ds, "ReadData");
m_mainDt = ds.Tables["ReadData"].Copy();
}
I'm getting all the data except from columns 5-6. I'm getting the titles, but not the data
the excel file is .xls
this also happend when i use this query:
SELECT * FROM[Sheet1$]
the file was corrupted. I've copied all the table to another file and it worked