Hi,

Is it possible to force a typed dataset to write out records with a
particular sort order on the WriteXml() method.

Thanks

Donal

Re: typed dataset and sort order on save by Miha

Miha
Wed Jan 05 05:57:26 CST 2005

I doubt it.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com

"Donal McWeeney" <macker@newsgroup.nospam> wrote in message
news:OnSDCEx8EHA.2060@TK2MSFTNGP10.phx.gbl...
> Hi,
>
> Is it possible to force a typed dataset to write out records with a
> particular sort order on the WriteXml() method.
>
> Thanks
>
> Donal
>
>



Re: typed dataset and sort order on save by Miha

Miha
Wed Jan 05 05:58:54 CST 2005

On the second thought, you might create another typeddataset, transfer rows
in desired order (from original dataset) and then invoke WriteXml on this
target dataset.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com

"Donal McWeeney" <macker@newsgroup.nospam> wrote in message
news:OnSDCEx8EHA.2060@TK2MSFTNGP10.phx.gbl...
> Hi,
>
> Is it possible to force a typed dataset to write out records with a
> particular sort order on the WriteXml() method.
>
> Thanks
>
> Donal
>
>



Re: typed dataset and sort order on save by Cor

Cor
Wed Jan 05 06:50:06 CST 2005

Donal,

A dataset directly holds no records.
However datatables holds rows, do you mean one or more datatables?

A simple way for that is this is

\\\
DataView dv = new DataView(dt);
dv.Sort = "bla"; // sorts column bla
DataTable dtnew = dt.Clone();
foreach (DataRowView dvr in dv)
dtnew.ImportRow(dvr.Row);
dt.Clear();
dt = dtnew.Copy();
///

I hope this helps?

Cor






Re: typed dataset and sort order on save by Donal

Donal
Wed Jan 05 07:43:03 CST 2005

Thanks for the replies ... I was hoping to avoid the manual intravention...


"Cor Ligthert" <notmyfirstname@planet.nl> wrote in message
news:OOBfVTy8EHA.2900@TK2MSFTNGP09.phx.gbl...
> Donal,
>
> A dataset directly holds no records.
> However datatables holds rows, do you mean one or more datatables?
>
> A simple way for that is this is
>
> \\\
> DataView dv = new DataView(dt);
> dv.Sort = "bla"; // sorts column bla
> DataTable dtnew = dt.Clone();
> foreach (DataRowView dvr in dv)
> dtnew.ImportRow(dvr.Row);
> dt.Clear();
> dt = dtnew.Copy();
> ///
>
> I hope this helps?
>
> Cor
>
>
>
>
>



Re: typed dataset and sort order on save by Miha

Miha
Wed Jan 05 08:13:05 CST 2005

Btw, why do you need an order?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com

"Donal McWeeney" <macker@newsgroup.nospam> wrote in message
news:uaO7gyy8EHA.3708@TK2MSFTNGP14.phx.gbl...
> Thanks for the replies ... I was hoping to avoid the manual
> intravention...



Re: typed dataset and sort order on save by W

W
Wed Jan 05 08:44:38 CST 2005

Donal:

You can traverse the XML document very easily using the XML namespace and
with XSLT - which you'd only have to write once - you can sort away any way
you'd like. Moreoever, like Miha mentions - a sort order on the save
probably isn't necessary - you can do the sorting whenever you deserialize
the dataset using the code that Cor showed you.

--
W.G. Ryan, MVP

www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
"Donal McWeeney" <macker@newsgroup.nospam> wrote in message
news:uaO7gyy8EHA.3708@TK2MSFTNGP14.phx.gbl...
> Thanks for the replies ... I was hoping to avoid the manual
intravention...
>
>
> "Cor Ligthert" <notmyfirstname@planet.nl> wrote in message
> news:OOBfVTy8EHA.2900@TK2MSFTNGP09.phx.gbl...
> > Donal,
> >
> > A dataset directly holds no records.
> > However datatables holds rows, do you mean one or more datatables?
> >
> > A simple way for that is this is
> >
> > \\\
> > DataView dv = new DataView(dt);
> > dv.Sort = "bla"; // sorts column bla
> > DataTable dtnew = dt.Clone();
> > foreach (DataRowView dvr in dv)
> > dtnew.ImportRow(dvr.Row);
> > dt.Clear();
> > dt = dtnew.Copy();
> > ///
> >
> > I hope this helps?
> >
> > Cor
> >
> >
> >
> >
> >
>
>



Re: typed dataset and sort order on save by Donal

Donal
Wed Jan 05 08:54:50 CST 2005

Just playing with a prototype at the moment which will be collecting lots of
data - If I need to manually edit the xml, having it stored in sorted format
will make it much easier...



Re: typed dataset and sort order on save by W

W
Wed Jan 05 10:15:46 CST 2005

XSLT is your friend ;-)

Since a DataSet is comprised of 0 or more tables - sorting is a bit dubious
here .... however with XSLT you can sort in any way you want and it's pretty
straightforward.

--
W.G. Ryan, MVP

www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
"Donal McWeeney" <macker@newsgroup.nospam> wrote in message
news:eAu1naz8EHA.2196@TK2MSFTNGP11.phx.gbl...
> Just playing with a prototype at the moment which will be collecting lots
of
> data - If I need to manually edit the xml, having it stored in sorted
format
> will make it much easier...
>
>