Click here to Skip to main content
15,919,422 members
Please Sign up or sign in to vote.
1.50/5 (2 votes)
See more:
Hi..
I have to save XML data into SQL server table..Can you help me how can i save data into table here i am pasting my XML code


XML
<form>
<body>

<Personal_Information_Section>
<First_Name>a</First_Name>
<Middle_Name/>
<Last_Name>a</Last_Name>
<Gender>male</Gender>
</Personal_Information_Section>

<Place>
<Name_and_Address>sadasdsa</Name_and_Address>
<District>Jalandhar</District>
<Village>Lohian2</Village>
</Place>

<Fee_Details>
<Fee>100</Fee>
<No_of_Copies>3</No_of_Copies>
<Total_Fee>300</Total_Fee>
</Fee_Details>

</body>
</form>




Please send me the code for saving this XML data into table
Posted
Updated 16-Jul-12 18:37pm
v2
Comments
Sergey Alexandrovich Kryukov 17-Jul-12 0:29am    
Who knows how to want to map it, what's the XML schema, and, finally, what's your problem?
--SA
Kenneth Haugland 17-Jul-12 0:44am    
If I remember correctly you can import a XML diectly to a Datatable (or Dataset) and you would then have everything you need...
Rajini.Y 17-Jul-12 0:48am    
yes i export XML into data set but the data set contains multiple tables like dataset1.tables["Personal_Information_Section"],dataset1.tables["Place"]...like that how can i store it
Bhushan futane 17-Jul-12 1:36am    
yes mindbrink i am also facing such problem ..
i have XML code like:
<Header>
<senderid>C001
<receiverid>MF469
<TransactionDate>28/04/2012 17:03</TransactionDate>
<recordcount>3
<dispositionflag>PRODUCTION
</Header>
<claim>
<id>1307
<idpayer>54235-45
<ProviderID>MF469</ProviderID>
<PaymentReference>NOT APPLICABLE</PaymentReference>
<datesettlement>28/04/2012 05:01
<encounter>
<facilityid>MF469

<activity>
<id>1.1307
<start>20/03/2012 12:00
<type>3
99214
<quantity>1
<net>196
<List>196</List>
<clinician>D969
<gross>196
<PatientShare>0</PatientShare>
<PaymentAmount>0</PaymentAmount>
<denialcode>ELIG-001

<activity>
<id>2.1307
<start>20/03/2012 12:00
<type>3
92567
<quantity>1
<net>98
<List>98</List>
<clinician>D969
<gross>98
<PatientShare>0</PatientShare>
<PaymentAmount>0</PaymentAmount>
<denialcode>ELIG-001


tell me what should i do..
ssd_coolguy 17-Jul-12 1:59am    
hey Bhushan_f & mindbrink,
if your dataset contains multiple tables, you can save it in database as below.
create as DA for table where you wanna insert and update DA using
DA.update(DS,"TableName")
Don't forget to create cammandbuilder :)

You need to write this last information in your question, as we sould understand what you have tried, it helps a lot. Anyway you could simply read this:
http://support.microsoft.com/kb/307548[^]
 
Share this answer
 
v2
I am not sure about this but i am giving small hint to u try like this

step 1) first create a object for particular database server.
step 2) next load the XML file into dataset
using

C#
Dataset ds=new Dataset();
ds.WriteXml("your xml file path");

then these object will assigned to database object.

Note: which fields(tags) u have in Xml file same columns fields in your sequel database.


.......I am not sure........my ...idea
 
Share this answer
 
v2

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