Results 1 to 3 of 3

Thread: Storing Tables In Xml file.

  1. #1
    Join Date
    Dec 2008

    Storing Tables In Xml file.

    Hi Friends,

    I have Two Tables

    Table A


    How can I design my XMl file for this tables?

    Please Help Me.

  2. #2
    Join Date
    Apr 2008

    Re: Storing Tables In Xml file.

    The simplest way to design XML is by using the dataset in

    1-create the query as follows,

    "SELECT Col1, Col2 FROM [Table A]
    SELECT Col1,NULL FROM [Table B]"

    2-Get the result in dataset1 in


    dataset1.WriteXml(path of file to save);

    by using this two methods you can easily create the xml file.

  3. #3
    Join Date
    May 2008

    Re: Storing Tables In Xml file.

    There are lots of ways to create the xml design.

    One way is already mentioned in the thread. That is loading the data into DataSet and use WriteXml method to get the xml as a output.

    Second is to get the xml directly from the SQL Server itself using FOR XML clause. If you are using SQL Server 2005 and above you can utilize the FOR XML Path to get required xml Structure.

    Following is the sample using For XML Clause

    SELECT A.Col1, A.Col2, B.Col3 FROM TblA A INNER JOIN TblB B ON A.Col1 = B.Col1 FOR XML PATH

    You can also look into FOR XML AUTO, FOR XML RAW, FOR XML EXPLICIT. Which ever is applicable to your requirement you can use that.

    Finally, If you are just looking to get only the xml then I will recomend to go with the FOR XML Clause than going with the DataSet approach which is a Costly operation than FOR XML Clause.

Similar Threads

  1. Storing of Application On SD Card In HTC
    By Plokstar in forum Portable Devices
    Replies: 4
    Last Post: 20-01-2011, 10:20 PM
  2. Storing VM Config files on HA File Server
    By Indulal in forum Operating Systems
    Replies: 4
    Last Post: 29-08-2010, 06:01 AM
  3. Storing database data into Map
    By Miles Runner in forum Software Development
    Replies: 5
    Last Post: 20-02-2010, 12:17 AM
  4. Storing photos on dvd
    By mohandas in forum Windows Software
    Replies: 3
    Last Post: 06-08-2009, 12:53 PM
  5. Storing MAC addresses in AD
    By boris52 in forum Active Directory
    Replies: 4
    Last Post: 27-07-2009, 10:57 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts