How to use C# to get column's description of Sql Server 2005?

对着背影说爱祢 提交于 2020-01-01 06:01:06

问题


I can use " Microsoft.SqlServer.Management.Smo.Table " in C# to get a table columns of a Sql Server 2005 database.

I have got the column.Name, but how can I get the column's Description in C#?

I have saw the link: SQL Server: Extract Table Meta-Data (description, fields and their data types)

But how can I use C# "Microsoft.SqlServer.Management.Smo" dll to get a column's Description?


回答1:


Say your Smo.Table object is named t.

This will get the description:

t.Columns["ProductID"].ExtendedProperties["MS_Description"].Value



回答2:


Why don't you use the result from the query described in the link you gave?



来源:https://stackoverflow.com/questions/1098630/how-to-use-c-sharp-to-get-columns-description-of-sql-server-2005

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!