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

Write dataset to xml and back again to dataset?

P: n/a
Before a delete on any table, I would like to write the contents of the
soon-to-be-deleted row to that application's single "graveyard" table
(alternate: or document as coded below).
SQL Server 2005 solution: I would store the tablename, today's date,
username, and the key column values of the soon-to-be deleted row as the
composite key of the new graveyard table row. The soon-to-be-deleted row's
data would be stored in a single xml-type column.
XML File solution: composite key from above would be the name of a
filename.xml file. The data from the soon-to-be-deleted row would be the
xml document. This is done by the following code:

Private Sub WriteXmlToFile(ByVal strGraveYardID As String, _

ByVal ds As DataSet)

'create a file name to write to.

Dim filename As String = "C:\Projects\Human Services\XMLGraveyard\" &
strGraveYardID & ".xml"

'create the FileStream to write with.

Dim myFileStream As New System.IO.FileStream(filename,

'create an XmlTextWriter with the fileStream.

Dim myXmlWriter As New System.Xml.XmlTextWriter(myFileStream,

'write to the file with the WriteXml method.



End Sub
The above works fine. Now, for the question. What about resurrecting the
deleted row from the graveyard row? Is there a way to convert the xml
document (or SQL Server 2005 data column) back into a dataset so that the
row can be re-inserted back into the original table?

Dean Slindee

Nov 12 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.