Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Storing Tables In Xml file.

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 01-01-2009
Member
 
Join Date: Dec 2008
Posts: 9
Storing Tables In Xml file.
  

Hi Friends,

I have Two Tables

Table A
Col1
Col2

TableB
Col1


How can I design my XMl file for this tables?

Please Help Me.

Reply With Quote
  #2  
Old 01-01-2009
Member
 
Join Date: Apr 2008
Posts: 2,001
Re: Storing Tables In Xml file.

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

1-create the query as follows,

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

2-Get the result in dataset1 in asp.net

then

dataset1.WriteXml(path of file to save);

by using this two methods you can easily create the xml file.
Reply With Quote
  #3  
Old 01-01-2009
Member
 
Join Date: May 2008
Posts: 2,008
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.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Storing Tables In Xml file."
Thread Thread Starter Forum Replies Last Post
Storing of Application On SD Card In HTC Plokstar Portable Devices 4 20-01-2011 11:20 PM
Storing VM Config files on HA File Server Indulal Operating Systems 4 29-08-2010 07:01 AM
Storing database data into Map Miles Runner Software Development 5 20-02-2010 01:17 AM
Storing photos on dvd mohandas Windows Software 3 06-08-2009 01:53 PM
Storing MAC addresses in AD boris52 Active Directory 4 27-07-2009 11:57 PM


All times are GMT +5.5. The time now is 09:56 PM.