How to import XML into SQL Server database?

How do I import xml data into a sql server database table in Windows form using c#?

  • I wanted to display Xml data into the sql server database table. First, I displayed the Xml data using the console application at run time, but now I want to store that XMl data into the database table. How can I do this? Himanshu Negi

  • Answer:

    Well, your XML is supposed to be a string (or it can easily be converted to). So you can do this: INSERT INTO your_table (your_col) SELECT xml_str I'm assuming you know how to connect to your db and run a SqlCommand after the connection is established...

Himanshu Negi at Stack Overflow Visit the source

Was this solution helpful to you?

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.