Fields Description

J

J E Jensen

Hello

I have a table with 78 fields. I use the Description ( typed in with
Enterprise Manager ) field to group my fields for displaying on a tabbed
dialog.

To get SchemaData I do.
SqlCommand cm = new SqlCommand("SELECT TOP 0 * FROM tblEmployee",
this.Connection);

cm.CommandType = CommandType.Text;

SqlDataAdapter da = new SqlDataAdapter( cm );

DataTable dt = new DataTable();

da.FillSchema(dt, SchemaType.Source);

DataColumnCollection dcc = dt.Columns;

DataColumn dc = dcc[1];

But the dc.Description value are always empty? How can I read this value?

Kind Regards
Johnny E Jensen
 
R

Rob T

I may be mistaken, by I don't think you can get the description field from
the schema. I was looking through some of my old code and I get the
description the "long way"...so I probably ran into the same roadblock at
some point.

Try this SQL statement in Query Analyzer. The "value" column is your
description. PS. if you run this in regular EM, value will just say
<binary>, but the QA will show it properly..

SELECT sysobjects.name AS TableName, syscolumns.name AS RecordName,
systypes.name AS Type, syscolumns.length, sysproperties.[value],
syscolumns.colorder
FROM sysobjects LEFT OUTER JOIN
syscolumns ON sysobjects.id = syscolumns.id LEFT OUTER
JOIN
sysproperties ON syscolumns.colid =
sysproperties.smallid AND syscolumns.id = sysproperties.id LEFT OUTER JOIN
systypes ON syscolumns.xtype = systypes.xtype
ORDER BY sysobjects.name, syscolumns.colorder
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top