Solved

C# Store XML in SQL database via .NET

Posted on 2016-08-04
6
33 Views
Last Modified: 2016-08-04
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>
0
Comment
Question by:CipherIS
  • 3
  • 2
6 Comments
 
LVL 39

Expert Comment

by:Kyle Abrahams
ID: 41742933
SQL has an xml datatype column or you can store it as a varchar.
0
 
LVL 1

Author Comment

by:CipherIS
ID: 41742942
Yes, I know it has an XML datatype column.
0
 
LVL 62

Expert Comment

by:Fernando Soto
ID: 41742951
And your question is then ?
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 1

Author Comment

by:CipherIS
ID: 41742973
How to store XML data in SQL Server via .NET as I stated above with my example.
0
 
LVL 39

Accepted Solution

by:
Kyle Abrahams earned 500 total points
ID: 41743044
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
 
LVL 1

Author Comment

by:CipherIS
ID: 41743081
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

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now