CipherIS
asked on
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>
Structure would be something like
<Settings>
<Key>abc</key><Value>123</
<Key>abcd</key><Value>1234
</Settings>
<Object>
<car>
<make>Camaro</make>
<year>1979</year>
</car>
<car>
<make>Corvette</make>
<year>1975</year>
</car>
</Object>
SQL has an xml datatype column or you can store it as a varchar.
ASKER
Yes, I know it has an XML datatype column.
And your question is then ?
ASKER
How to store XML data in SQL Server via .NET as I stated above with my example.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
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
http://www.morgantechspace.com/2014/05/How-to-Store-and-Read-CSharp-Class-Object-into-Sql-Server.html