如何使用C#获取列的Sql Server 2005描述?

时间:2021-12-18 04:23:59

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

我可以在C#中使用“Microsoft.SqlServer.Management.Smo.Table”来获取Sql Server 2005数据库的表列。

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

我有column.Name,但是如何在C#中获取列的描述?

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

我看到了链接:SQL Server:提取表元数据(描述,字段及其数据类型)

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

但是如何使用C#“Microsoft.SqlServer.Management.Smo”dll来获取列的描述?

2 个解决方案

#1


6  

Say your Smo.Table object is named t.

假设您的Smo.Table对象名为t。

This will get the description:

这将得到描述:

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

#2


1  

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

为什么不使用您提供的链接中描述的查询结果?

#1


6  

Say your Smo.Table object is named t.

假设您的Smo.Table对象名为t。

This will get the description:

这将得到描述:

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

#2


1  

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

为什么不使用您提供的链接中描述的查询结果?