Home All Groups Group Topic Archive Search About

How to fomat table columns as attributes rather than elements

Author
8 Aug 2006 6:32 AM
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.

--
moondaddy@noemail.noemail

Author
8 Aug 2006 8:14 AM
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.)
Author
8 Aug 2006 9:45 AM
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!



--
moondaddy@noemail.noemail
Show quote
"Kevin Yu [MSFT]" <v-k***@online.microsoft.com> wrote in message
news:MWzKmKsuGHA.6004@TK2MSFTNGXA01.phx.gbl...
> 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.)
>
Author
9 Aug 2006 5:04 AM
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.)
Author
9 Aug 2006 5:26 AM
Cor Ligthert [MVP]
Moondaddy,

As Kevin wrote is working with a Treeview different than using a complex
data control as the DataGrid or DataGridView.

To get almost the same with elements as using attributes in a DataSet is
using the "Nested" property from the dataset.

http://msdn2.microsoft.com/en-us/library/7sfkwf9s.aspx

I hope this helps,

Cor


Show quote
"moondaddy" <moondaddy@noemail.noemail> schreef in bericht
news:ua$488suGHA.1372@TK2MSFTNGP04.phx.gbl...
> 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!
>
>
>
> --
> moondaddy@noemail.noemail
> "Kevin Yu [MSFT]" <v-k***@online.microsoft.com> wrote in message
> news:MWzKmKsuGHA.6004@TK2MSFTNGXA01.phx.gbl...
>> 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.)
>>
>
>
Author
11 Aug 2006 6:04 AM
moondaddy
Great.  thanks to the both of you!

--
moondaddy@noemail.noemail
Show quote
"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
news:eGmYnQ3uGHA.4160@TK2MSFTNGP06.phx.gbl...
> Moondaddy,
>
> As Kevin wrote is working with a Treeview different than using a complex
> data control as the DataGrid or DataGridView.
>
> To get almost the same with elements as using attributes in a DataSet is
> using the "Nested" property from the dataset.
>
> http://msdn2.microsoft.com/en-us/library/7sfkwf9s.aspx
>
> I hope this helps,
>
> Cor
>
>
> "moondaddy" <moondaddy@noemail.noemail> schreef in bericht
> news:ua$488suGHA.1372@TK2MSFTNGP04.phx.gbl...
>> 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!
>>
>>
>>
>> --
>> moondaddy@noemail.noemail
>> "Kevin Yu [MSFT]" <v-k***@online.microsoft.com> wrote in message
>> news:MWzKmKsuGHA.6004@TK2MSFTNGXA01.phx.gbl...
>>> 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.)
>>>
>>
>>
>
>

AddThis Social Bookmark Button