Click here to Skip to main content
15,892,537 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi
i have data in xml format. but i insert the same data in sqlserver tables.

using asp.net coding is C#

how ????????????

help me.......
Posted
Updated 10-Aug-11 21:58pm
v2

C#
<pre lang="text"><pre lang="HTML"><pre lang="CSS"><pre lang="Javascript"><pre lang="SQL"><pre lang="SQL"><pre lang="PHP"><pre lang="PHP"><pre lang="PHP"><pre lang="Delphi"><pre lang="Delphi"><pre lang="Delphi"><pre lang="Delphi"><pre lang="Delphi"><pre lang="Delphi"><pre lang="Delphi"><pre lang="Delphi"><pre lang="Delphi"><small><small><small><a href=""></a>[<a href="" target="_blank"></a>]</small></small></small>
 
Share this answer
 
To add to previous answers, here's one starting point in MSDN: http://msdn.microsoft.com/en-us/library/ms189887.aspx[^]
 
Share this answer
 
Use following code to retrieve data from XML File and transfer to sql:

 try
            {
                XmlReader xmlFile;
                xmlFile = XmlReader.Create("Product.xml", new XmlReaderSettings());
                DataSet ds = new DataSet();
                ds.ReadXml(xmlFile);
// Here you can insert your code to save your dataset contents to Sql Server easily.

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            } 


Hope this will help you.
 
Share this answer
 
Fetch data from XML using LINQ
or Read XML using DATASET or DATATABLE [datasetObj.ReadXML() or datatableObj.ReadXML()].

Iterate through Record you have acquired and insert it into your desired table.
Hope it will help you......
 
Share this answer
 
SQL does have a very good XML support. Read about it on MSDN and give it a try. Do not hesitate to post a specific question if you are not able to work your way through it.
 
Share this answer
 
Comments
Wendelius 11-Aug-11 10:42am    
Good answer, my 5 :)

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900