开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜