C# Store XML in SQL database via .NET

I want to store XML in SQL Database using .NET with a class

Structure would be something like

<Settings>
<Key>abc</key><Value>123</Value>
<Key>abcd</key><Value>1234</Value>
</Settings>
<Object>
    <car>
       <make>Camaro</make>
       <year>1979</year>
   </car>
    <car>
       <make>Corvette</make>
       <year>1975</year>
   </car>
</Object>
LVL 1
CipherISAsked:
Who is Participating?
 
Kyle AbrahamsConnect With a Mentor Senior .Net DeveloperCommented:
update table set xml_column = '<Settings>
<Key>abc</key><Value>123</Value>
<Key>abcd</key><Value>1234</Value>
</Settings>
<Object>
    <car>
       <make>Camaro</make>
       <year>1979</year>
   </car>
    <car>
       <make>Corvette</make>
       <year>1975</year>
   </car>
</Object>'

Open in new window

0
 
Kyle AbrahamsSenior .Net DeveloperCommented:
SQL has an xml datatype column or you can store it as a varchar.
0
 
CipherISAuthor Commented:
Yes, I know it has an XML datatype column.
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
Fernando SotoRetiredCommented:
And your question is then ?
0
 
CipherISAuthor Commented:
How to store XML data in SQL Server via .NET as I stated above with my example.
0
 
CipherISAuthor Commented:
Thanks I found below example to pass the XML via .NET to SQL Server.

http://www.morgantechspace.com/2014/05/How-to-Store-and-Read-CSharp-Class-Object-into-Sql-Server.html
0
All Courses

From novice to tech pro — start learning today.