Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

C# Store XML in SQL database via .NET

Posted on 2016-08-04
6
Medium Priority
?
70 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 41

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 64

Expert Comment

by:Fernando Soto
ID: 41742951
And your question is then ?
0
Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

 
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 41

Accepted Solution

by:
Kyle Abrahams earned 2000 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…

877 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