Is there no built in way to get a table's schema in ADO.NET?
I want to get a table's schema in order. This question and its answer is exactly my question, and what I want to do. However it feels (to me) pretty hackish, and being two years old now I was hoping that the answer was out-of开发者_如何学Go-date. Is there truly still no way to get a table's schema in its native order? (e.g. ADOX's OpenSchema(adSchemaTables...)
)?
Subjective side-question: is this not a huge gaping hole in ADO.NET in general!?
exec sp_help '<tablename>'
or
select * from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = '<tablename>' order by ORDINAL_POSITION
You can use GetSchema on the Connection object.
精彩评论