Click here to Skip to main content
15,566,152 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

now i have a huge table with more than 300 column , when i used the following code

OdbcDataReader DbReader = DbCommand.ExecuteReader();
DataTable MyTable = DbReader.GetSchemaTable();

i am getting only 255 columns only

what should i do??
hypermellow 15-Sep-15 5:10am    
What is your Table? ... Excel? ... Flat File? ... MS Access? ... MSSQL Server ... Oracle?
AhmedOsamaMoh 15-Sep-15 9:20am    
well it is my second ques.
i am trying to make an odbc database explorer
so i was trying to make it for general , for any odbc enabled database
but seem that i must make a customization for every database type

my current database is sybase and i found the only working solution is to use a stored procedure called sp_columns
hypermellow 15-Sep-15 9:29am    
Ah I see. I was wondering if you had hit the excel/access 255 column limitation. Maybe the limitation is in the driver you are using?
... good luck with the database explorer :-)

1 solution

There's the following note in the MSDN documentation[^]:
To make sure that metadata columns return the correct information, you must call ExecuteReader with the behavior parameter set to KeyInfo. Otherwise, some of the columns in the schema table may return default, null, or incorrect data.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900