I am new to C# so I apologize if this is a simple task. What I would like to do open an XML file whose root node is a table name and the children of the root node are field names and values. I would then like to map the fields to the root node’s table in a SQL Server database and update or insert as needed. Does anyone know if there is a more elegant way to do this than looping through the node tree and building out the SQL string? It seems like there should be a way to bind the fields as if the XML document were a form, only it would only exist in memory. Again, sorry if this question has an obvious answer. Thanks in advance for any help.
Share
I use OPENXML method to solve such tasks. There is example from BOL how to select the data from XML:
So, you can use INSERT .. SELECT FROM OPENXML statement to insert this data to DB.