Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 585
Mike108 Avatar asked Jul 08 '09 15:07

Mike108


People also ask

How is C used?

C programming language is a machine-independent programming language that is mainly used to create many types of applications and operating systems such as Windows, and other complicated programs such as the Oracle database, Git, Python interpreter, and games and is considered a programming foundation in the process of ...

Is C easy for beginners?

C is a general-purpose language that most programmers learn before moving on to more complex languages. From Unix and Windows to Tic Tac Toe and Photoshop, several of the most commonly used applications today have been built on C. It is easy to learn because: A simple syntax with only 32 keywords.

How do I start C programming?

To start using C, you need two things: A text editor, like Notepad, to write C code. A compiler, like GCC, to translate the C code into a language that the computer will understand.

What is -= in C?

-= Subtract AND assignment operator. It subtracts the right operand from the left operand and assigns the result to the left operand. C -= A is equivalent to C = C - A.


2 Answers

Say your Smo.Table object is named t.

This will get the description:

t.Columns["ProductID"].ExtendedProperties["MS_Description"].Value
like image 108
khutch Avatar answered Oct 20 '22 13:10

khutch


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

like image 23
crauscher Avatar answered Oct 20 '22 11:10

crauscher