xml->dataSet->dataAdapter->MsSqlDb

supafly

New member
Joined
May 25, 2005
Messages
1
Hi
Pulling data from database through sqldataadapter to a dataset, and then write it to a file was really easy, so I thought that it would be equal easy to reverse it, but I cant quite figure it out.

I can load the xml document into a DataSet, now I just want to push the data onward by a DataAdapter to a Mssql database.

Xml nodes will have same names as the database tables and fields

<PARENT>
<PARENTID>99</PARENTID>
<CHILD>
<GRANDCHILD1>14</GRANDCHILD1>
<GRANDCHILD2>991</GRANDCHILD2>
<GRANDCHILD3>99</GRANDCHILD3>
<GRANDCHILD4>99</GRANDCHILD4>
...
</CHILD>
<CHILD>
...
</CHILD>
</PARENT>

Any hints on this one? plz...would prefer c# example if any1 have suggestions.
 
Try creating a datatable from the MSSQL table where youre going to store the data, create a database from the XML, and add the rows in the XML datatable to the MSSQL datatable (create a row from the MSSQL datatable and copy the items from a row in the XML datatable to this new row, then add the new row to the MSSQL datatable). I dont believe you can do it as simply as youre thinking.
 
Back
Top