How to fomat table columns as attributes rather than elements

M

moondaddy

I'm new to .net 2.0 and I want to create a dataset using the designer where
the table columns are attributes rather than elements. I could do this
before in 1.1 but I dont see how in 2.0. Please advise.

Thanks.
 
K

Kevin Yu [MSFT]

Hi moondaddy,

I don't recommend you change a column into attributes. Because this is not
corresponding to the DataSet schema. And you might fail to get data from
it, because ReadXml or ReadXmlSchema will not acknowledge attributes as
columns.

Is there any particular reason that you need to change this?

Kevin Yu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
M

moondaddy

Yes, all the code examples I see for working with treeview controls in
asp.net use xml with attributes. I'm having trouble learning how to use the
code in these various examples when the dataset is much different from the
example's xml.

In particular, I'm working with a table which has a recursive relationship.
when I create a dataset and add the recursive relationship to it, fill it
with data from the db, and look at the xml via ds.getxml or writing it to a
file, it has the nested hierarchy that I would expect. So far so good.
however, I cant get it to work using the code examples that use attributes.

I tried using For XML but that's a real pain for recursive relationships
where you don't know the depth of the tree.

any good recommendations?

also, if I use For XML then I cant use the benefits of working with the
dataset since the dataset doesn't like attributes.

uuhg!
 
K

Kevin Yu [MSFT]

Hi Moondaddy,

The TreeView and DataSet are different. The TreeView is a control, and
attributes are used to mark its nodes. However, the standard for DataSets
uses element as columns. We cannot change this or the DataSet class will
mis-parse the schema. The code sample for TreeView does not match the
situation for DataSets.

Since sub elements and attributes are all sub-nodes to and element, I
suggest you make some changes to the existing code, and make it work for
DataSet.

Kevin Yu
Microsoft Online Community Support
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

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