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,

      '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

slindee1 (2)
11/10/2005 6:30:30 PM
dotnet.xml 7266 articles. 0 followers. Follow

0 Replies

Similar Articles

[PageSpeed] 16


Similar Artilces:

Reverying back to Office 2004 from Office 2008
I need to revert back to Office 2004 because Office 2008 Student Edition won't access my Exchange Server. How would I go about this while keeping my identitry? From the last several posts in this thread, under "how to go back" http://groups.google.com/group/microsoft.public.mac.office.entourage/browse_thread/thread/64543d7f938c0c09/5b9cd43909f48421#5b9cd43909f48421 2 options: 1) use Entourage 2008 to export an archive of your identity. Entourage 2004 should be able to open that archive. (File Export and File Import) 2) Your Office 2004 identity should still be in username...

Form is appearing off the screen- how do I get it to come back?
I edited a Access form on a dual monitor machine, and now people with smaller monitors can't see it- where is the property to determine where it appears? ...

Writing Exchange 2003 DR documentation
Hi there, I'm not sure to be in the right group. I will however post my message here. I actually don't have problems with my exchange environment, my question is more disaster recovery oriented. I'm trying to put in place all possible problem scenarios with decision tree to help decision maker.take decisions (in case of disaster). I'm System engineer in the company, and competences are more active directory oriented. However, in my daily job, I support exchange users and I'm "exchange administrator" too. You know, budget restrictions. So, I will as...

recieve copy back that e-mail recieved and opened
i want to reive a meggeg back that e-mail has been recieved and opened ...

XML Serialisation & Circular References
I have been able to get simple circular references to be serialized in xml by using the ImportTypeMapping method on the SoapReflectionImporter class. But I am unable to serialise circular references when the circular reference is contained with in a collection class, specifically I am using a custom ArrayList object. I keep getting a StackOverFlow Exception from the XmlSerializer class when attempting the serialisation. The classes are: Class A, Class B - this is derived from System.Collection.ArrayList Class C. Class A contains an instance of B Class B contains multiple instances of C Cl...

check writing conversion
I'm looking for a way to take a numeric amount and convert it to alpha-numeric text -- for use in a check writing application. I've successfully writen a series of functions to do this, but it's very sloppy. Is there perhaps an ADD-IN to assist in this? Asked often http://tinyurl.com/us67 -- Don Guillett SalesAid Software donaldb@281.com "Kit Carson" <xqqme2day@yahoo.com> wrote in message news:57e801c3a979$7f0b9bb0$7d02280a@phx.gbl... > I'm looking for a way to take a numeric amount and > convert it to alpha-numeric text -- for use in a check >...

I have small problem with XslTransformation. I get from WebService xml document. I have xslt and I want transform xml document to html code. It's look easy but I cant't manage with xPath. Maybe someone help me with that. I have problems with xPath in xslt file. I can't navigate by names only by vertical and horizontal axis. What's wrong .... --- Code --- // WebService XmlForAnalysis.Xmla xa = new XmlForAnalysis.Xmla(); xa.Url = urlXmla; XmlForAnalysis.Properties properties = new XmlForAnalysis.Properties(); properties.Content = XmlForAnalysis.Content.Data; // Result Xml...

Merging XML Documents (with ADO.NET?)
I have got 2 XML documents, both of which conform to the same XSD Schema, which define possible optional elements. The 2 XML documents contain 2 disjoint set of XML elements. What is the best, easiest, most efficient way of merging the 2 XML Documents? Can I use DataSet.Merge() facility in ADO.NET?? Any pre-requisites? Any other suggestions? Patrick, Can you provide an example of each XML document? Its not clear to me how the schema can be the same if each XML document has different sets of XML elements. Also, you didn't indicate what you wanted to do after merging the XML ...

Transforming a typed dataset
Hello, I need to reorder a Typed DataSet in memory using an Xsl Transform. Most of the examples use stream which write to the hard disk or xml file. I want to do this in memory and then write the resulting Typed Dataset into a Session object which will be reused on multiple postbacks and then finally saved when editing is done. Get various problems depending on what objects I use, rather than go through each one I will post what I have and see if anyone can suggest where to go from here. Xsl is simple, reordering (this is done becuase onitemupdate of datagrid I delete element then add a n...

Xml Serialization problem...
Hi, I am trying to use xml serialization to simplify load/save functions in some classes i have created and am hitting a few problems. Any help to either would be most appreciated. I have created a MasterShape class which contains a name, and a 'Shapes' class object, which itself uses the ICollection interface to provide a class which is basically an array of shapes i derive from an abstract base class AbShape, for example i derive Rectangle and Circle from AbShape and wish to be able to store any combination of these shapes.. The problems.. 1) As far as i know classes which imple...

Export to XML question
Hi All, The below is a test code to export xml file. The fields Comment and Tip hold xHTML code. The problem occurs if I add the Tip field then I get the following error: The XML page cannot be displayed Required white space was missing. Error processing resource 'file:///C:/1.xml'. Line 1, Position 646 It seems that XM file cannot fully exported and some text is missing. I apprecaite any input. DECLARE @SQL VARCHAR(1024) DECLARE @sqlFlds1 VARCHAR(225) DECLARE @sqlFlds2 VARCHAR(225) DECLARE @sqlFlds3 VARCHAR(225) DECLARE @sqlFlds4 VARCHAR(225) DECLARE @sqlSt...

Most efficient method of searching large xml document
I am looking for the most efficient way of searching a large xml document (> 14mg). If I could get some pointers in the right direction. I am using VB.NET. It is readonly. Jim Kitterman wrote: > I am looking for the most efficient way of searching a large xml > document (> 14mg). If I could get some pointers in the right > direction. I am using VB.NET. It is readonly. If you don't need sophisticated querying such as XPath, just take XmlTextReader. -- Oleg Tkachenko [XML MVP, XmlInsider] http://blog.tkachenko.com XmlReader approach is the most performant and resour...

How can I get the standard back ground color of a form?
I changed the color of my custom switch board form and could not change back to the form original color as none of the colors in the fill/back color matches the original color( one which is default when we create a new FORM). Any thoughts? -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201002/1 "mls via AccessMonster.com" <u55943@uwe> wrote in message news:a3c875d73012e@uwe... > I changed the color of my custom switch board form and could not change > back > to the form original color as none o...

Clicked a .prf. file and woosh
Help! I accidentally clicked on a file with a .prf extension (some utility that keeps it preferences stored in such a file). To my surprise this not only started Outlook but also triggered some Outlook installation dialog. When I clicked that away I ended up with a completely new and empty Outlook! At first I was flabberghasted, since ALL my mails, my calendar entries, contacts, etc. EVERYTHING seemed gone! When I just doublechecked I saw, that this thing apparently created a new Outlook1.pst file which seems to be used as the new default. It seems that my old file "Outlook.pst&q...

moving/exporting backup files back to microsoft outlook (not express)
I have been trying to import files from a backup file that was done in Outlook Express format. The files were backed up from Microsoft Outlook after a virus disabled my computer (laptop). The files were backed up to another computer which used Outlook Express. After my hard drive was formated, the files were copied to my desktop under backups. I would like to get the files back to Outlook from Outlook Express. I have tried to import these, however only one file copies. Can someone help me with this ASAP. Thanks so much, Shelby you should be able to import the messages directly...

Excel 2002/2003 XML Spreadsheet: Random crashing
I've been successfully creating and using XML Spreadsheets programmatically for some time now, without issues, even with spreadsheets that are 40-80MB large. However, for a recent project, we created a spreadsheet (in Excel) and saved it in the XML Spreadsheet format. It contains several dozen worksheets with financial calculations (nothing fancy, no add-ins or macros) and numerous lookup functions to worksheets in the same file (no external references or named regions). Unforunately, we are running into CONSTANT issues with Excel completely crashing while saving the file in XML Spreadsh...

Linq to xml not working
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Net; using System.IO; using System.Data; using System.Xml; using System.Xml.XPath; using System.Xml.Linq; using System.Diagnostics; namespace TelSearchModule { public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { ///Start Test // Load XML doc XDocument rssFeed = XDocument.Load("http://tel.searc...

Copying Back end to web-based server
Hello, I have a split front end and back end database. I'm trying to put it on a server that is webbased so that when I try to copy, it says it doesn't accept locked files. Is that mean it's making it a read-only copy? When I try to copy a simple MSAccess databse, I get the same error, but when I copy a MS Word document, I have no problem. Has someone had this problem before and what did you do? Varvara ...

I'm trying to work with XML/XSLT in the Visual Studio IDE (VS 2005) and when I select the menu option XML/Show XSLT Output I get a tab with the output showing the text HTML code. I'd like to have it display like it would in a browser instead. I'm working around it by coding the path to the XSLT into the XML file, keeping a browser open and hitting the refresh button which isn't a huge deal, but I was wondering if there's a configuration option or some way to have it display the way it would look in a browser in the IDE. Any links to documentation about this would be ...

How do I get back the uninstall file for WLM?
I have been wrestling with this for a few weeks now. Can't log in to WLM, I have reinstalled Windows 7 2x now and cannot find the uninstall files to clean uninstall and reinstall the messenger. Any suggestions as to how to get it back? -- Computers make it easier to do a lot of things, but most of the things they make it easier to do don''t need to be done. Andy Rooney US news commentator (1919 - ) Hi, You can't log into Windows Live Messenger with version 7.2x any longer. You need to upgrade to the latest version. http://messengersays.spaces...

Retrieving values from XML file
I want to be able access an xml file using an XPath? query to go to a specific node. Once I have that node I want to be able to retrieve the value of an attribute. Can't seem to get this working using the 2.0 Framework. Here's a sample of the XML <Agency> <vu_Agency AgencySysNo="1" Name="Dept 1"/> <vu_Agency AgencySysNo="2" Name="Dept 2"/> </Agency> The code I'm playing with is... Dim document As XPathDocument = New XPathDocument(ConfigurationManager.AppSettings("xmlPath").ToString() & "A...

Appts. bounce back
I am admin for an Exchange 2003 with only 5 users. The users each have a local domain account. The domain is not registered , only used in house. They use a POP3 for email btween not only themselves, but all their outside customers. The client(Outlook 2003) is configured with the POP3 account first, then the Exchange account. All incoming mail is delivered to the exchange account Inbox to prevent Local and exchange accounts from showing up in the folder list, confuses the users Here is what happens: When an Appt. is forwarded to an outside email address, it either gets bounced or goes...

rules, dotnet applications and XML
<xml newbie> Hi all, We are considering using XML to specify rules, policies. This XML file will be used to generate source code in either managed C++ or C#, which will be implemention of API to be used by different applications program (written in .NET language, for this dicussion). You can contribute your ideas. Time for an example. A company or a government body has lot of policies which can be captured in the form of IF-THEN rules. These rules needs to be accomodated in application program(s). o Imagine an application program which processes visa applications, social security etc...

Does DPM back up Active Directory Lightweight Directory Services
Am implementing an LDAP and the preference would be the Microsoft Active Directory Lightweight Directory Services but need to ensure it is capable of being backed up by DPM LDAP is a protocol that AD services provide. So backing/Recovering AD services is supported by DPM. So LDAP should work without any issues after AD recovery using System State backup/recovery using DPM. In case of recovery on alternate machines you might need to turn on the LDAP services after system State recovery. -- Thanks, Praveen D [MSFT] This posting is provided "AS IS" with no w...

Help with Linq to Dataset
Hi, I have a problem with Linq to Dataset that have N rows and 13 columns, the first colums represents a bank and the other 12 are the months. What I need is to get rows that have the same bank and one chosen month. Dim months() As String() ={"Jan","Feb".......} Dim banks= From q In dtTempDataTable _ Where q.Field(Of String)(0) = bank_ Group By CC = q.Field(Of String)(0), DD = q.Field(Of Double)((Array.IndexOf(months, singleMonth) + 1)) _ Into Group _ Select New With...