Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default reading excel 2007 returns 255 columns!

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
());
  #2   Report Post  
Posted to microsoft.public.excel.programming
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" ??
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default reading excel 2007 returns 255 columns!



"dk" wrote:

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" ??

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default reading excel 2007 returns 255 columns!

max number of columns that excel 2007 supports is 16k
http://visio.mvps.org/Excel_2007.htm

so I have 280, and when read the sheet - the result is 255. My question is
why?

The total number of available columns in Excel 256 (2^8) 16k (2^14)
"dk" wrote:

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" ??

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading Excel 2007 Rows in C# / .Net BethH Excel Programming 1 March 11th 09 04:21 AM
Reading and writing to ini files in Excel 2007 Rolf Gustafsson Excel Programming 3 January 18th 09 08:38 PM
EXCEL 2007 reading E as power of ten DoubleZ Excel Discussion (Misc queries) 2 August 1st 08 05:30 PM
Excel: reading tables with multiple rows and columns R.A. Clarke Excel Programming 1 July 16th 08 01:22 PM
Stop Excel reading 01/02 as 1st February 2007 Jon Stenning Excel Discussion (Misc queries) 5 July 30th 07 04:58 PM


All times are GMT +1. The time now is 05:18 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"