With C# and SQL Server 2005 and by using DbConnection.GetSchema() method, I want to get all a table's columns (not of views) only. I have found two collection names related to this
Columnsthat returns table and views' columnsViewColumnsreturns all the view's columns
Neither of above two returns table columns only, nor they have any property to filter Table-columns.
Any help is respected.
I don't see any easy way to do this with this particular API you're trying to achieve this with - but why not just use a query like this to get your information?
Just load that into a
SqlCommandand execute it against the open connection you have and read the result into someDataTableor other structure for your use. This gives you only table columns - and all of them.