View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
dk[_2_] dk[_2_] is offline
external usenet poster
 
Posts: 21
Default reading excel 2007 returns 255 columns!

On Apr 28, 1:47*am, wrote:
hi,

why I still get result 255 columns as I have approximately 280 in my
test1.xlsx
here is the code used

string connectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=C:\test1.xlsx;Extended Properties=""Excel 12.0;HDR=YES;""";

* * * * * * string strSQL = "SELECT * FROM [test$]";
* * * * * * OleDbConnection excelConnection = new OleDbConnection
(connectionString);

* * * * * * OleDbCommand dbCommand = new OleDbCommand(strSQL,
excelConnection);
* * * * * * OleDbDataAdapter dataAdapter = new OleDbDataAdapter
(dbCommand);

* * * * * * System.Data.DataTable dTable = new System.Data.DataTable
();
* * * * * * dataAdapter.Fill(dTable);
* * * * * * Trace.WriteLine(dTable.Columns.Count.ToString
());



Maximum no. of columns that you can have is 256. What do you mean by
"approximately 280 in my test1.xlsx" ??