By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,905 Members | 1,585 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,905 IT Pros & Developers. It's quick & easy.

Importing Selected Data from XML

P: n/a
In order to achieve the archiving of old data from my database I have
exported the information from my dataset to an XML file using the
standard WriteXML method of the object. Now suppose in the future I
wish to restore only specific records (which all have a unique
reference) from that file back to the dataset so they can be restored
back to the database.

Can anyone tell me how I can allocate specific references so that only
those records are imported from the XML?

Regards

Lee
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
This section of the programming guide talks about using datasets to update
the original data source:
http://msdn.microsoft.com/library/en...aseUpdates.asp

There is a ReadOnly property, RowState, attached to each row in the dataset.
RowState can be Unchanged, Added, Deleted, or Modified. When you Fill a
Dataset, the RowState for each row is set to "Unchanged". If you
subsequently change a row, the RowState for that row is then set to
"Modified". Later if you call da.Update() using that dataset, the rows that
have RowState=Modified will be re-applied to the original database. (using
the UpdateCommand on the data adapter).

But maybe you are talking about a "restore" case, or a scenario where you
want to slurp in a dataset from one source, and then push that dataset, or a
subset of it, into another datasource. In this case, updating any column
in the rows to be updated will allow you to do what you want. You could use
a timestamp column, for example.

But what if you don't want to update any of the columns? What if you want
EXACTLY the same data to be pushed back to a different datasource? The
problem is the RowState is readonly, so you cannot modify it directly.

This is a common scenario.
Here's an article on how to do it.
http://www.knowdotnet.com/articles/datasetmerge.html

-D
"Lee Ottaway" <le*********@nuesoft.co.uk> wrote in message
news:17**************************@posting.google.c om...
In order to achieve the archiving of old data from my database I have
exported the information from my dataset to an XML file using the
standard WriteXML method of the object. Now suppose in the future I
wish to restore only specific records (which all have a unique
reference) from that file back to the dataset so they can be restored
back to the database.

Can anyone tell me how I can allocate specific references so that only
those records are imported from the XML?

Regards

Lee

Nov 12 '05 #2

P: n/a
This section of the programming guide talks about using datasets to update
the original data source:
http://msdn.microsoft.com/library/en...aseUpdates.asp

There is a ReadOnly property, RowState, attached to each row in the dataset.
RowState can be Unchanged, Added, Deleted, or Modified. When you Fill a
Dataset, the RowState for each row is set to "Unchanged". If you
subsequently change a row, the RowState for that row is then set to
"Modified". Later if you call da.Update() using that dataset, the rows that
have RowState=Modified will be re-applied to the original database. (using
the UpdateCommand on the data adapter).

But maybe you are talking about a "restore" case, or a scenario where you
want to slurp in a dataset from one source, and then push that dataset, or a
subset of it, into another datasource. In this case, updating any column
in the rows to be updated will allow you to do what you want. You could use
a timestamp column, for example.

But what if you don't want to update any of the columns? What if you want
EXACTLY the same data to be pushed back to a different datasource? The
problem is the RowState is readonly, so you cannot modify it directly.

This is a common scenario.
Here's an article on how to do it.
http://www.knowdotnet.com/articles/datasetmerge.html

-D
"Lee Ottaway" <le*********@nuesoft.co.uk> wrote in message
news:17**************************@posting.google.c om...
In order to achieve the archiving of old data from my database I have
exported the information from my dataset to an XML file using the
standard WriteXML method of the object. Now suppose in the future I
wish to restore only specific records (which all have a unique
reference) from that file back to the dataset so they can be restored
back to the database.

Can anyone tell me how I can allocate specific references so that only
those records are imported from the XML?

Regards

Lee

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.