Click here to Skip to main content
14,641,397 members
Rate this:
Please Sign up or sign in to vote.
See more:
I want to read the XML file(not the entire content but only 2 XML tags)
and store in a database using asp.net(c#)
Posted
Rate this:
Please Sign up or sign in to vote.

Solution 1

It looks like you need to query XML to find particular data in it. In this case, you need LINQ to XML.

Please use the class System.Xml.Linq.XDocument; this is the most adequate way similar to that of XmlDocument, supporting LINQ to XML Programming.
See http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.aspx[^], http://msdn.microsoft.com/en-us/library/bb387063.aspx[^].

See also:
http://msdn.microsoft.com/en-us/library/bb387061.aspx[^],
http://msdn.microsoft.com/en-us/library/bb387098.aspx[^].

—SA
   
Rate this:
Please Sign up or sign in to vote.

Solution 2

Hi,

Use LinqToXml to get specific xml element from entire xml,as SA mentiond...
Then use ADO.NET (SqlConnecton and SqlCommand if db is sql server) to insert data into db...

If you want better answer then update your question with details: XML example, what part of xml you want to save, what db you are using (MS SQL Server, MySQL, Access...), table definition (name and structure), then we will give you better answer...
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month



CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100