Access extended properties from a dataset

Greetings, I added some extended properties to some columns in my sql 2005 table, but I'm having trouble accessing these properties from my dataset.  Do I need to remove my TableAdaptor compeletly and re-add it in my .xsd file in order for me to be able to access the extended propeties I added?  Here is the VB code I'm trying.

For Each DC As DataColumn In ourData.Cont.Columns
     If DC.ExtendedProperties.ContainsKey("Prop1") AndAlso DC.ExtendedProperties.Item("Prop1").ToString = "Y" Then
          ' Do something...
     End If

DC.ExtendedProperties.count is 0 for some reason
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Try using the fn_listextendedproperty function when you create your dataset:

--View  extended property
SELECT * FROM ::fn_listextendedproperty(NULL,'user','dbo','table',urTable,NULL,NULL)

fn_listextendedproperty (
    { default | [ @name = ] 'property_name' | NULL }
    , { default | [ @level0type = ] 'level0_object_type' | NULL }
    , { default | [ @level0name = ] 'level0_object_name' | NULL }
    , { default | [ @level1type = ] 'level1_object_type' | NULL }
    , { default | [ @level1name = ] 'level1_object_name' | NULL }
    , { default | [ @level2type = ] 'level2_object_type' | NULL }
    , { default | [ @level2name = ] 'level2_object_name' | NULL }

ChaffeAuthor Commented:
JRossi1, I'm still new to this.  can you tell me where does the syntax of the fn_listextendedproperty goes?
When you create your dataset, use the following SQL Statement, substituting your table name etc...,

"SELECT   * FROM   ::fn_listextendedproperty (NULL, 'user', 'dbo', 'table', 'YourTableName', 'column', default)"  The following dataset will be created:

objtype      objname   name        value

COLUMN      id      caption      Employee ID
COLUMN      id      MS_Description      Employee unique ID
COLUMN      name      caption      Employee Name
COLUMN      name      MS_Description      Employee Full Name

You can loop through this dataset and populate a table, DataGrid, etc... with a tables extended properties.  In the 'name' column, 'MS_Description' refers to the column description in the design view of a SQL table.

Let me know if you need further clarification.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

ChaffeAuthor Commented:
JRossi1,  Thanks for the clarificaiton, I got it working.  Now if I want to get the acutal table data and the properties of the columns, I would have to send 2 SELECT queries to get what I want?

SELECT   * FROM   ::fn_listextendedproperty (NULL, 'user', 'dbo', 'table', 'MyTable', 'column', default);
SELECT   * FROM   MyTable;
Correct....  In your last comment, the first SELECT statement would return only the table properties and the 2nd SELECT statement would return the data...
ChaffeAuthor Commented:
Got it.  Thanks for your help
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.