Add(new XElement("Sub Group", value)); // Commit the changes to the database db.

fieldset{ background: #f3f4f5; /* Background for Site */ background: #fafafa; } html, button, input, select, textarea, a, ul.social-link a, .widget.widget_nav_menu ul li a, pre { color: #656a6f; /* General Body Text Color*/ color: #656a6f; } #the-content a{ color: #ffc000; color: #ffc000; } ul li:before, h1 span, h2 span, h3 span, h4 span, .highlight, h5, h6, cite, h1:after, h2:after, h3:after, .main-container a:hover, .more:before, ol td.expand:before, ul.social-link a:hover, #nav ul li a:hover:before, ul.page-numbers .current, #nav li a:hover, ul.comments h5 a, .comment-reply-link:before, .comment-edit-link:before, #cancel-comment-reply-link:before, .link-pages p a, #wp-calendar a, .logo-text:after, .widget.widget_nav_menu ul li a:hover, .statistics li h4, ul.filters li.active a, .toggle-btn.active, .accordion-btn.active, ul.tab-nav li.active, h4.v_nav.v_active, .foot-widgets a:hover, .foot-widgets a:hover b { color: #ffc000; /* Feature Color*/ color: #fa1291; } a.btn, input[type=button], nav li.current-menu-item a, li.current-menu-parent a, input[type=submit], #menu-icon, ol.graphs li, .flex-control-paging li a.flex-active, ul.page-numbers li a.prev:hover, ul.page-numbers li a.next:hover, ul.paging a:hover span, .header-container li a{ background-color: #ffc000; /* Button Back Ground Color*/ background-color: #fa1291; color: #fff; /* Button Text Color*/ color: #fff; } a.btn:hover, input[type=button]:hover, nav a:hover, nav a:before, nav li.current-menu-item a:hover, li.current-menu-parent a:hover, input[type=submit]:hover, #menu-icon.active, #nav ul, .nav-parent.hover a, .header-container li a:hover, .flex-control-paging li a, ul.page-numbers li a.prev, ul.page-numbers li a.next, ul.paging a span{ background-color: #646d72; /* Button Back Ground Color on Hover*/ background-color: #2c2a2b; color: #fff; color: #fff; } h1, h2, h3, h4, a, h1 a, h2 a, h3 a, h4 a, #response .success, .success:before, #response .failure, #header_logo, .logo-text, .statistics li h6, .toggle-btn, .accordion-btn, ul.tab-nav li, h4.v_nav{ color: #2d3438; /* Headings Color*/ color: #1c1a1b; } strong, b, .lead, table th, blockquote, .more, a, .tweet, ul.pagination li a, ul.comments h5 a:hover, .comment-reply-link, .comment-edit-link, .link-pages, .link-pages p a:hover, #wp-calendar a:hover, #wp-calendar caption{ color: #3c4a52; /* bold text Color*/ color: #1c1a1b; } #masthead, #slides { background: #a4aeb0!

important; /* Home Page Masthead Background Color - Match to image*/ background: #a4aeb0!

Recently, I have discussed about getting started linq to sql in c#

If you are using LINQ to SQL to manage the interaction between your database and your application, you will notice that any columns you have defined as an XML SQL data type are represented using the XElement class in the generated classes. Definition property is a representation of an XML column // Get the first 'Group' element and add a new Sub Group child XElement element = report. After some research it appears that when Submit Changes is called on the Data Context, it checks the entities it has retrieved to see if any changes were made.

This makes working with XML data stored in a database very easy and convenient. To do this, the Data Context must cache the original values it retrieved from the database. Add(new XElement("Sub Group", value)); // Force a reference inequality report. Definition); // Commit the changes to the database db.

But, today I ran into a problem while trying to update the XML stored in the database. // Get a report for the database Report report = (from r in db. The problem with the code above is that when you access and change the report. Submit Changes(); Now when the Data Context checks to see if anything has changed, there will be a reference inequality between the original Report.

Submit Changes(); The problem was that the changes made to the XML found in the Definition property were committed to the Data Context but not to the database.

I ran into an interesting issue with LINQ to SQL yesterday. As I expected, LINQ to SQL wasn’t too happy with this scenario.

Unfortunately LINQ to SQL will only throw an exception when you try to Insert or Delete a record with no primary key. It’s actually quite obvious when you look into what is happening.

To do an update you would usually do something like this: Therefore LINQ to SQL doesn’t know that your record has changed (so can’t warn you that it can’t update).

Now that you understand the problem the solution is simple: Define a primary key in your table.