I'm writing a client to connect to a legacy system (pre-.NET) which only
accepts input and provides output using ADO Recordsets.

I've been able to convert Recordset to DataSet, and if the DataSet has
no changes I can convert back to Recordset.

The problem comes when converting DataSet to Recordset when rows have
been deleted or updated. The only way I could find to do the conversion
involves "hand-crafting" the XML for the ADO Recordset combined with
running an XSLT transform on the DataSet data. What I can't do is
access the original rows in the DataSet in order to write <rs:update>,
<rs:original>, and <rs:delete> elements and their child rows in the
<rs:data> section.

This data must be in there somewhere, otherwise how could a DataSet
update a database directly? Does anyone know how I can get to it?
Alternatively, if I'm missing an obvious way of making this easier,
please can someone enlighten me ;-)

Thanks
Ian

Re: Accessing deleted and changed rows in a DataSet by Sahil

Sahil
Wed May 25 17:16:41 CDT 2005

Ian,

YOu can get the original rows by using DataTable.Select("",
DataRowState.Original)

HTH,


--

- Sahil Malik [MVP]
http://codebetter.com/blogs/sahil.malik/





"Ian Harding" <iharding160@hotmail.com> wrote in message
news:3fjoajF84tpbU1@individual.net...
> I'm writing a client to connect to a legacy system (pre-.NET) which only
> accepts input and provides output using ADO Recordsets.
>
> I've been able to convert Recordset to DataSet, and if the DataSet has
> no changes I can convert back to Recordset.
>
> The problem comes when converting DataSet to Recordset when rows have
> been deleted or updated. The only way I could find to do the conversion
> involves "hand-crafting" the XML for the ADO Recordset combined with
> running an XSLT transform on the DataSet data. What I can't do is
> access the original rows in the DataSet in order to write <rs:update>,
> <rs:original>, and <rs:delete> elements and their child rows in the
> <rs:data> section.
>
> This data must be in there somewhere, otherwise how could a DataSet
> update a database directly? Does anyone know how I can get to it?
> Alternatively, if I'm missing an obvious way of making this easier,
> please can someone enlighten me ;-)
>
> Thanks
> Ian



Re: Accessing deleted and changed rows in a DataSet by Ian

Ian
Thu May 26 04:46:19 CDT 2005

Sahil Malik [MVP] wrote:
> Ian,
>
> YOu can get the original rows by using DataTable.Select("",
> DataRowState.Original)
>
> HTH,
>
>

Brilliant! Thank you, I can select through the various values of
DataRowState to generate insert, update (new plus original rows) and delete.

Even more work to generate the ADO Recordset XML now as I can't even use
XSLT, but then I never expected this to be easy!

Thank you.

Re: Accessing deleted and changed rows in a DataSet by Sahil

Sahil
Thu May 26 14:43:13 CDT 2005

Yes, moving from Dataset over an interop boundary - no matter how you do it,
is never as simple as it may look.

One thing you may try is to extract a diffgram, and then pass that over as
XML. Just a thought.


--

- Sahil Malik [MVP]
http://codebetter.com/blogs/sahil.malik/



"Ian Harding" <iharding160@hotmail.com> wrote in message
news:3flk68F8g58qU1@individual.net...
> Sahil Malik [MVP] wrote:
> > Ian,
> >
> > YOu can get the original rows by using DataTable.Select("",
> > DataRowState.Original)
> >
> > HTH,
> >
> >
>
> Brilliant! Thank you, I can select through the various values of
> DataRowState to generate insert, update (new plus original rows) and
delete.
>
> Even more work to generate the ADO Recordset XML now as I can't even use
> XSLT, but then I never expected this to be easy!
>
> Thank you.