{"id":7353,"date":"2004-08-30T17:10:00","date_gmt":"2004-08-30T17:10:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/vbteam\/2004\/08\/30\/transactional-update-using-tableadapters\/"},"modified":"2024-07-05T14:58:50","modified_gmt":"2024-07-05T21:58:50","slug":"transactional-update-using-tableadapters","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/vbteam\/transactional-update-using-tableadapters\/","title":{"rendered":"Transactional Update using TableAdapters"},"content":{"rendered":"<p class=\"MsoNormal\"><span>As promised, I&rsquo;ve put together a sample that demonstrates how to create a transactional update using the new Whidbey TableAdapters.<\/span><span><font size=\"2\"> <\/p>\n<p><\/font><a href=\"http:\/\/windowsforms.net\/samples\/ThreeLevelUpdate.zip\"><u><font color=\"#0000ff\" size=\"2\">http:\/\/windowsforms.net\/samples\/ThreeLevelUpdate.zip<\/font><\/u><\/a><\/p>\n<p><\/span><\/p>\n<p class=\"MsoNormal\"><span>In this sample I create a Parent, Child and Grandchild relationship.<span>&nbsp; <\/span>The tables are named, Parent, Child and Grandchild&hellip; <\/span><span><span>J<\/span><\/span><span><\/p>\n<p><\/span><\/p>\n<p class=\"MsoNormal\"><span>Using the sample you can see the differences between single table updates and a transactional update.<\/p>\n<p><\/span><\/p>\n<p class=\"MsoNormal\"><span>The single table update will commit each table individually and can get you in a partial state.<span>&nbsp; <\/span><span>&nbsp;&nbsp;<\/span>If you delete a row in the Parent table, then delete a row in the child and grandchild table, then use the Simple Update, the update will fail.<span>&nbsp; <\/span>I did not implement cascading updates in the database.<span>&nbsp; <\/span>So, deleting a parent where children still exist is a relational no-no. <span>&nbsp;&nbsp;<\/span><\/p>\n<p><\/span><\/p>\n<p class=\"MsoNormal\"><span><\/p>\n<p>&nbsp;<\/p>\n<p><\/span><\/p>\n<p class=\"MsoNormal\"><span>If you update the three tables with the &ldquo;Smart Update&rdquo; I use transaction and delete the rows before deleting the parents.<span>&nbsp; <\/span>Life is good.<\/p>\n<p><\/span><\/p>\n<p class=\"MsoNormal\"><span><\/p>\n<p>&nbsp;<\/p>\n<p><\/span><\/p>\n<p class=\"MsoNormal\"><span>Now I must fully acknowledge that this should be the out-of-the-box behavior.<span>&nbsp; <\/span>And for that I apologize.<span>&nbsp; <\/span>We did outline some ideas early on, but we ultimately didn&rsquo;t get them done.<\/p>\n<p><\/span><\/p>\n<p class=\"MsoNormal\"><span><\/p>\n<p>&nbsp;<\/p>\n<p><\/span><\/p>\n<p class=\"MsoNormal\"><span>I promise to explain this further as I have time.<span>&nbsp; <\/span>I&rsquo;ve been promising to get this out, so I wanted to at least get the sample up for others to take a look at.<span>&nbsp; <\/span><\/p>\n<p><\/span><\/p>\n<p class=\"MsoNormal\"><span><\/p>\n<p>&nbsp;<\/p>\n<p><\/span><\/p>\n<p class=\"MsoNormal\"><b><span>Works in Everett<\/p>\n<p><\/span><\/b><\/p>\n<p class=\"MsoNormal\"><span>I should note that theirs nothing about this example that couldn&rsquo;t be applied to Visual Studio 2003.<span>&nbsp; <\/span>I&rsquo;m simply showing how to incorporate this work into our new TableAdapters.<\/p>\n<p><\/span><\/p>\n<p class=\"MsoNormal\"><span><\/p>\n<p>&nbsp;<\/p>\n<p><\/span><\/p>\n<p class=\"MsoNormal\"><span>Steve<\/p>\n<p><\/span><\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>As promised, I&rsquo;ve put together a sample that demonstrates how to create a transactional update using the new Whidbey TableAdapters. http:\/\/windowsforms.net\/samples\/ThreeLevelUpdate.zip In this sample I create a Parent, Child and Grandchild relationship.&nbsp; The tables are named, Parent, Child and Grandchild&hellip; J Using the sample you can see the differences between single table updates and a [&hellip;]<\/p>\n","protected":false},"author":260,"featured_media":8818,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[192,195],"tags":[],"class_list":["post-7353","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-featured","category-visual-basic"],"acf":[],"blog_post_summary":"<p>As promised, I&rsquo;ve put together a sample that demonstrates how to create a transactional update using the new Whidbey TableAdapters. http:\/\/windowsforms.net\/samples\/ThreeLevelUpdate.zip In this sample I create a Parent, Child and Grandchild relationship.&nbsp; The tables are named, Parent, Child and Grandchild&hellip; J Using the sample you can see the differences between single table updates and a [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/posts\/7353","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/users\/260"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/comments?post=7353"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/posts\/7353\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/media\/8818"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/media?parent=7353"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/categories?post=7353"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/tags?post=7353"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}