473,322 Members | 1,398 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Write dataset to xml and back again to dataset?

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,
System.IO.FileMode.Create)

'create an XmlTextWriter with the fileStream.

Dim myXmlWriter As New System.Xml.XmlTextWriter(myFileStream,
System.Text.Encoding.Unicode)

'write to the file with the WriteXml method.

ds.WriteXml(myXmlWriter)

myXmlWriter.Close()

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?
Thanks,

Dean Slindee

Nov 12 '05 #1
0 1053

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Filippo Pandiani | last post by:
I have a grid that shows the file list from a folder. On the postback, how do I get a Dataset from this grid? Thanks, Filippo.
16
by: Geoff Jones | last post by:
Hi Can anybody help me with the following, hopefully simple, question? I have a table which I've connected to a dataset. I wish to add a new column to the beginning of the table and to fill...
2
by: Dean Slindee | last post by:
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...
13
by: processoriented | last post by:
I am trying to find the best approach to do something here... situation is this... One of the tables in my dataset is a "Work Order" table with information about what needs to be done and where. ...
12
by: =?Utf-8?B?QW5kcmV3?= | last post by:
I am simple tryint to learn how to use the ADO.NET code. Can anybody tell me if I am using it right or not? Imports System.Data.sqlclient Imports System.Data Public Class Form1 Inherits...
15
by: Joseph Geretz | last post by:
I'm a bit puzzled by the current recommendation not to send Datasets or Datatables between application tiers. http://support.microsoft.com/kb/306134 ...
8
by: Matt MacDonald | last post by:
Hi all, First of all, I am not trying to be the guy who comes in here shouting his mouth off at Microsoft. However, ever sinse I started using typed datasets in VS2005 I have been fighting with a...
12
by: Rainer Queck | last post by:
Hi NG, I have no idea why, but since a while a dataset refuses to write to a specific xml file. I get the error message "Der Zugriff auf den Pfad...
1
by: jc | last post by:
RE: Why use a CollectionBase class here vs dataset or dataview? I'm looking at some vb.net 2005 code that was generated from a homegrown Codesmith Template that generate all of the retreival and...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.