问题
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-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!?
回答1:
exec sp_help '<tablename>'
or
select * from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = '<tablename>' order by ORDINAL_POSITION
回答2:
You can use GetSchema on the Connection object.
来源:https://stackoverflow.com/questions/4155993/is-there-no-built-in-way-to-get-a-tables-schema-in-ado-net