<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx</link><description>In previous posts this month I showed how to use LINQ to SQL classes with a couple different Combobox data binding scenarios. (You can read those articles here and here .) Today I'm going to show you how to create a one-to-many data entry form (and we'll</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#7805122</link><pubDate>Wed, 20 Feb 2008 02:23:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7805122</guid><dc:creator>DotNetKicks.com</dc:creator><description>&lt;p&gt;You've been kicked (a good thing) - Trackback from DotNetKicks.com&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#7808340</link><pubDate>Wed, 20 Feb 2008 05:26:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7808340</guid><dc:creator>burrowsuw</dc:creator><description>&lt;p&gt;Hi Beth,&lt;/p&gt;
&lt;p&gt;WhenI was teaching, I had a student who came to my office to tell me that I used the word &amp;quot;irregardless&amp;quot;. She let me know that since I was a professor, I should know better and use the proper word, i.e., regardless.&lt;/p&gt;
&lt;p&gt;I learned the original word from listening to my mom, who uses irregardless to this day.&lt;/p&gt;
&lt;p&gt;Anyway, I thought I would be a pedant and let you know that the test in your message box that says &amp;quot;Your data was saved.&amp;quot; is incorrect (sorry, I ma just getting back at that student). The word &amp;quot;data&amp;quot; is plural, so you should say &amp;quot;Your data were saved.&amp;quot;&lt;/p&gt;
&lt;p&gt;How about that for a useless and dumb comment :)&lt;/p&gt;
&lt;p&gt;bill&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#7809455</link><pubDate>Wed, 20 Feb 2008 06:34:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7809455</guid><dc:creator>Allan</dc:creator><description>&lt;p&gt;Data leads a life of its own quite independent of datum, of which it was originally the plural. It occurs in two constructions: as a plural noun (like earnings), taking a plural verb and plural modifiers (as these, many, a few) but not cardinal numbers, and serving as a referent for plural pronouns (as they, them); and as an abstract mass noun (like information), taking a singular verb and singular modifiers (as this, much, little), and being referred to by a singular pronoun (it). Both constructions are standard. The plural construction is more common in print, evidently because the house style of several publishers mandates it. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;In the case of messages from within this context (a master/detail form) the singular modifier is infered as we are saving a single record even though it may have many associated child records.&lt;/p&gt;
&lt;p&gt;I couldn't leave that post unaswered, sorry!&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#7809496</link><pubDate>Wed, 20 Feb 2008 06:36:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7809496</guid><dc:creator>Allan</dc:creator><description>&lt;p&gt;Great post by the way. &amp;nbsp;It answers quite a few questions I have had. &amp;nbsp;On a slightly different path, is there a way we can determine the templates the generated code uses?&lt;/p&gt;
&lt;p&gt;Thanks in advance.&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#7815583</link><pubDate>Wed, 20 Feb 2008 14:05:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7815583</guid><dc:creator>karl1406</dc:creator><description>&lt;p&gt;Beth,&lt;/p&gt;
&lt;p&gt;Love your work! &amp;nbsp;Thanks for sharing with us.&lt;/p&gt;
&lt;p&gt;Karl&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#7816135</link><pubDate>Wed, 20 Feb 2008 14:52:47 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7816135</guid><dc:creator>Hernan</dc:creator><description>&lt;p&gt;Hi Beth!&lt;/p&gt;
&lt;p&gt;Your blog and videos are amazing and really usefull!&lt;/p&gt;
&lt;p&gt;This is my first comment, or let me say my first question : Did you test this master-detail scenario using uniqueidentifiers as keys?&lt;/p&gt;
&lt;p&gt;Is not binding the databinidingsource of the details table when I navigate the master table...&lt;/p&gt;
&lt;p&gt;Thanks. &lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#7819470</link><pubDate>Wed, 20 Feb 2008 18:34:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7819470</guid><dc:creator>Josh Stodola</dc:creator><description>&lt;p&gt;Beth,&lt;/p&gt;
&lt;p&gt;Thanks for posting this. &amp;nbsp;I definitely learned a few things from it. &amp;nbsp;Keep up the great work!&lt;/p&gt;
&lt;p&gt;LMAO @ bill's comment. &amp;nbsp;I think if she put that sentence in the message box, more people would &amp;nbsp;comment to say &amp;quot;You have a typo in your message box&amp;quot;. &amp;nbsp;And LMAO even harder at Allan's response to bill (at least the percentage of the response that I was able to comprehend).&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#7819654</link><pubDate>Wed, 20 Feb 2008 18:48:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7819654</guid><dc:creator>Peter Kellner</dc:creator><description>&lt;p&gt;Nice! &amp;nbsp;good to have it spelled out so cleanly.&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#7820766</link><pubDate>Wed, 20 Feb 2008 20:10:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7820766</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Allan,&lt;/p&gt;
&lt;p&gt;You can't change the templates the designer uses. You'd have to write your own code generator.&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#7820809</link><pubDate>Wed, 20 Feb 2008 20:14:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7820809</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Hernan,&lt;/p&gt;
&lt;p&gt;Yes this will work with uniqueidentifiers. Actually, it's even easier than DataSets in this case because you can set in the model the class's guid property to &amp;quot;Auto Generated Value&amp;quot; = True and Auto-Sync = OnInsert and then just specify the default on the database column to (newid()) and it will handle it all for you. I suspect something is wrong with the BindingSources. Make sure that the child's BindingSource's DataSource property is set to the parent's BindingSource.&lt;/p&gt;
&lt;p&gt;HTH,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#7887962</link><pubDate>Mon, 25 Feb 2008 07:13:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7887962</guid><dc:creator>Allann</dc:creator><description>&lt;p&gt;Hi Beth,&lt;/p&gt;
&lt;p&gt;I found out that edmx files use the SingleFilegenerator &amp;quot;Custom Tool&amp;quot; to generate the code behind files as do other &amp;quot;wizards&amp;quot;, so it's just a matter of writing your own to output your own code behind. &amp;nbsp;Is this what you meant when you said &amp;quot;write your own code generator&amp;quot;?&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Allan&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#7895289</link><pubDate>Mon, 25 Feb 2008 21:54:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7895289</guid><dc:creator>Chris Rock</dc:creator><description>&lt;p&gt;Beth,&lt;/p&gt;
&lt;p&gt;I'm compiling a list of articles, tutorial and opinions about LINQ TO SQL. I hope you don't mind but I added a few of your links to the list.&lt;/p&gt;
&lt;p&gt;Chris&lt;/p&gt;
</description></item><item><title>Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#7897746</link><pubDate>Tue, 26 Feb 2008 04:04:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7897746</guid><dc:creator>Beth Massi - Sharing the goodness that is VB</dc:creator><description>&lt;p&gt;In the last few posts on LINQ to SQL I've showed how to set up an object model using the O/R designer&lt;/p&gt;
</description></item><item><title>Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#7897857</link><pubDate>Tue, 26 Feb 2008 04:29:18 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7897857</guid><dc:creator>Noticias externas</dc:creator><description>&lt;p&gt;In the last few posts on LINQ to SQL I&amp;amp;#39;ve showed how to set up an object model using the O/R designer&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#7898192</link><pubDate>Tue, 26 Feb 2008 06:17:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7898192</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Alan,&lt;/p&gt;
&lt;p&gt;Yep. Here's an example that may interest you: &lt;a rel="nofollow" target="_new" href="http://code.msdn.microsoft.com/sampleedmxcodegen"&gt;http://code.msdn.microsoft.com/sampleedmxcodegen&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;HTH,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#7898197</link><pubDate>Tue, 26 Feb 2008 06:18:45 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7898197</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Chris,&lt;/p&gt;
&lt;p&gt;I don't mind at all. You may also want to check out Code Gallery for LINQ to SQL samples: &lt;a rel="nofollow" target="_new" href="http://code.msdn.microsoft.com/Project/ProjectDirectory.aspx?TagName=LINQ%20to%20SQL"&gt;http://code.msdn.microsoft.com/Project/ProjectDirectory.aspx?TagName=LINQ%20to%20SQL&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;HTH,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#7908730</link><pubDate>Tue, 26 Feb 2008 22:43:55 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7908730</guid><dc:creator>Chris Rock</dc:creator><description>&lt;p&gt;Beth,&lt;/p&gt;
&lt;p&gt;Thank you for that link!&lt;/p&gt;
&lt;p&gt;Chris&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#7960382</link><pubDate>Fri, 29 Feb 2008 23:26:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7960382</guid><dc:creator>James</dc:creator><description>&lt;p&gt;Hi Beth&lt;/p&gt;
&lt;p&gt;I saw your sub&lt;/p&gt;
&lt;p&gt;Private Sub BindingNavigatorDeleteItem_Click() _&lt;/p&gt;
&lt;p&gt;But if I want to display a error message to the user and retrieve the info, how I can do that?&lt;/p&gt;
&lt;p&gt;Thanks you for your help&lt;/p&gt;
&lt;p&gt;James&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#7992976</link><pubDate>Mon, 03 Mar 2008 01:05:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7992976</guid><dc:creator>Rikki</dc:creator><description>&lt;p&gt;Hi Beth,&lt;/p&gt;
&lt;p&gt;I'm not sure this is the right place to ask this, but since I've searched high and low, I'll give it go anyway.&lt;/p&gt;
&lt;p&gt;I'm trying to update a row in a datagrid, much like you describe above, which contains several dropdownlists. One of them has a foreignkey to my table 'tblCapacity' whit null values allowed. When I try to edit a row where a null value is currently in the capacityID attribute I get the message:''CapacityDropDownList' has a SelectedValue which is invalid because it does not exist in the list of items.&lt;/p&gt;
&lt;p&gt;Parameter name: value'&lt;/p&gt;
&lt;p&gt;I've tried (a mix from your code above and Scott Guthrie's in LINQ to SQL Part 9) to change the selectstatement of the linqdatasource I use for the dropdownlist like so:&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Protected Sub CapacityLinqDataSource_Selecting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.LinqDataSourceSelectEventArgs) Handles CapacityLinqDataSource.Selecting&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim campaignXL As New CampaignXLDataClassesDataContext&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim iNullable As Nullable(Of Integer)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim emptyCapacity As tblCapacity() = _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{New tblCapacity With {.capacityCode = &amp;quot;&amp;lt;Select a capacity&amp;gt;&amp;quot;, .capacityID = iNullable}}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim capacity = (From Empty In emptyCapacity).Union( _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;From tblCapacity In campaignXL.tblCapacities _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Order By tblCapacity.capacityCode)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;e.Result = capacity&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;End Sub&lt;/p&gt;
&lt;p&gt;This doesn't work (when I edit the row it gives an error saying iNullable should have a value); when I assign '0' to iNullable it gives me the earlier error message (for a good reason because the null value is still not present in the linqdataset for the dropdownlist.&lt;/p&gt;
&lt;p&gt;It seems to work if I make a dynamicdata project out of my datamodel, so somehow there is a solutions for this problem. Hope you can help my, thanks in advance,&lt;/p&gt;
&lt;p&gt;Rikki&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#8093300</link><pubDate>Fri, 07 Mar 2008 13:31:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8093300</guid><dc:creator>Grzegorz</dc:creator><description>&lt;p&gt;Great text! Very helpfull.&lt;/p&gt;
&lt;p&gt;Now I see DataSet is dead - the end of database concept. Welcome to business objects concept.&lt;/p&gt;
&lt;p&gt;Thats a pitty that O/R designer cannot set the association properties and one has to do it in xml. I think maybe service pack 1 for VS 2008...&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#8187405</link><pubDate>Fri, 14 Mar 2008 00:37:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8187405</guid><dc:creator>Fatih</dc:creator><description>&lt;p&gt;Hi, been learning from you for a few weeks now, much respect.&lt;/p&gt;
&lt;p&gt;I get an error with your program when i do something i will guide below, after which everything fails (need to restart program).&lt;/p&gt;
&lt;p&gt;1: on a new orderdetail fill in only quantity and price, leave combobox as is.&lt;/p&gt;
&lt;p&gt;2: Try to save. You'll get a warning.&lt;/p&gt;
&lt;p&gt;3: Now highlight this orderdetail we worked on and delete..&lt;/p&gt;
&lt;p&gt;4: Now save again and you get an error about relation violation. After this you cant work with the database anymore.&lt;/p&gt;
&lt;p&gt;Can you Beth or anyone else tell how to fix this? I think this will happen with everyone.&lt;/p&gt;
&lt;p&gt;Thanks great tutes xx&lt;/p&gt;
</description></item><item><title>LINQ to SQL N-Tier Smart Client - Part 1 Building the Middle-Tier</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#8385507</link><pubDate>Sat, 12 Apr 2008 19:27:13 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8385507</guid><dc:creator>Beth Massi - Sharing the goodness that is VB</dc:creator><description>&lt;p&gt;In my previous posts on LINQ to SQL I showed how to build LINQ to SQL classes and set up the data binding&lt;/p&gt;
</description></item><item><title>LINQ to SQL N-Tier Smart Client - Part 2 Building the Client</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#8393819</link><pubDate>Mon, 14 Apr 2008 21:08:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8393819</guid><dc:creator>Beth Massi - Sharing the goodness that is VB</dc:creator><description>&lt;p&gt;In my last post we built the service and data access layer for our LINQ to SQL N-Tier application. In&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#8408393</link><pubDate>Fri, 18 Apr 2008 20:04:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8408393</guid><dc:creator>Simone</dc:creator><description>&lt;p&gt;Hi Beth. Great articles!!!&lt;/p&gt;
&lt;p&gt;I have a question, I read your articles about smart client with Linq. I have to implement a connected client with Linq. My problem is he following:&lt;/p&gt;
&lt;p&gt;Suppose I mapped with Linq tables Orders, OrderDetails and OrderDetailLines. An order has many OrderDetails and each OrderDetail has many detailLines. I created a formOrder where I Have a datacontext and I retrieve info about an order and I show a grid with orderDetails. All is databound. If I doubleclick on a detail row I show another form: OrderDetailForm (I pass to the form the rowDataboundItem) where I show OrderDetail and a grid with OrderDetailLines. I want to implement an UNDO feature, so if I modify an OrderDetailLine and then I press &amp;quot;Cancel Button&amp;quot; the orderdetailLine object is not modified. The same is for the orderdetail. I tried to implement IEditableObject but I have problems with relations properties (they return empty). I can't get &amp;quot;GetOriginalEntityState&amp;quot; methods because I must have the ability of edit a child object, then press ok to update it, the re-edit and press &amp;quot;Cancel&amp;quot; (and I want last updated values, not db values).&lt;/p&gt;
&lt;p&gt;I'ts a very frustrating problem from me...It's five days I try every kind of solutions...!&lt;/p&gt;
&lt;p&gt;The problem is that with databinding values are automatically updated. I could clone objects but I have a large number of business objects and implement a clone method would mean too many days.&lt;/p&gt;
&lt;p&gt;Any idea??&lt;/p&gt;
&lt;p&gt;Thank's in advance and sorry for the english...!&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#8449839</link><pubDate>Fri, 02 May 2008 11:46:47 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8449839</guid><dc:creator>Brian in England</dc:creator><description>&lt;p&gt;Please can you put all this new programming in to new video, as an add on the ‘Use DataSets in an N-Tier Application’ as I find it hard to follow. &lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#8468131</link><pubDate>Thu, 08 May 2008 03:56:51 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8468131</guid><dc:creator>Gonzalo</dc:creator><description>&lt;p&gt;Hi Beth,&lt;/p&gt;
&lt;p&gt;Awesome topics. Thanks for being such a soothing breeze in the &amp;quot;Sea of Linq&amp;quot;. Would you suggest a way to handle Default Values With LINQ to SQL. I would like to be able to use my default values previously set on my SQL database with Linq when I do an insert to a table for data entry.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Gonzalo&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#8508460</link><pubDate>Thu, 15 May 2008 19:42:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8508460</guid><dc:creator>Burton Roberts</dc:creator><description>&lt;p&gt;The OMS_log.ldf file seems to be missing on the download. &amp;nbsp;I can't seem to attach OMS without it.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Your work is great.&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#8514921</link><pubDate>Fri, 16 May 2008 23:37:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8514921</guid><dc:creator>Burton Roberts</dc:creator><description>&lt;p&gt;Okay, I built the OMS from scratch in SQLExpress. I just installed SQL 2008 Feb CTP, moved it, and upgraded to VS2008 SP1 (beta) and Framework 3.5 SP1 &amp;nbsp;I'm not getting the OrderDetails collection represented within the &amp;quot;Order&amp;quot; Class in Data Sources window after I drag the Order table onto it. However I am getting &amp;quot;Orders&amp;quot; (not &amp;quot;Order&amp;quot;) under Customer.&lt;/p&gt;
&lt;p&gt;BTW the table is &amp;quot;Orders&amp;quot; in the database and magically becomes &amp;quot;Order&amp;quot; in the OMS.dbml. &amp;nbsp;Why, and could this be an issue. I then changed the name to &amp;quot;Orders&amp;quot;, rebuilding and still getting no representation of the OrderDetails collection.&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#8519406</link><pubDate>Mon, 19 May 2008 21:11:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8519406</guid><dc:creator>George Gopie</dc:creator><description>&lt;p&gt;Hi Beth,&lt;/p&gt;
&lt;p&gt;I am building a small application with Master Detail forms. iave the DB design with necessary Primary Keys and FK's. I have combo boxes on some columns in the Detail forms. I am unablke to update or save new data from the DEtail forms.&lt;/p&gt;
&lt;p&gt;Can you Please advise.&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#8519684</link><pubDate>Mon, 19 May 2008 23:55:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8519684</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Burton,&lt;/p&gt;
&lt;p&gt;When you attempt to attach the mdf file just remove the LDF reference and click OK. SQL-Server will rebuild it. You can also run the sample as it is packaged as a user instance. &lt;/p&gt;
&lt;p&gt;I'm not sure of the SP1 beta behavior but in the released version as long as you have referential integrity set up on your tables and you drag both of them onto the LINQ to SQL O/R designer, it will infer the relationships. The designer will rename your classes to singular but the child collections on the class are plural properties. This is just the default, you can change it.&lt;/p&gt;
&lt;p&gt;HTH,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#8519689</link><pubDate>Mon, 19 May 2008 23:57:45 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8519689</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi George,&lt;/p&gt;
&lt;p&gt;Does the sample provided with this post work for you? Check the update statements and make sure you are calling EndEdit on the binding sources before attempting to save.&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#8554083</link><pubDate>Tue, 27 May 2008 08:07:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8554083</guid><dc:creator>Gonzalo Chiriboga</dc:creator><description>&lt;p&gt;Hi Beth, &lt;/p&gt;
&lt;p&gt;Thanks in advance! Would you suggest a way to handle Default Values With LINQ to SQL. I would like to be able to use my default values previously set on my SQL database with Linq when I do an insert to a table for data entry.&lt;/p&gt;
&lt;p&gt;Apologies for insisting on this question.&lt;/p&gt;
&lt;p&gt;Warm regards,&lt;/p&gt;
&lt;p&gt;G&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#8555359</link><pubDate>Tue, 27 May 2008 22:36:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8555359</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Gonzalo,&lt;/p&gt;
&lt;p&gt;If you want the defaults to appear on the objects when you add them to the collections you can do this in a variety of ways. You can take a look at the OnCreated partial method to set values when the object is created. But since LINQ to SQL classes are just plain CLR classes you could also just create a non-default constructor and pass it any values you want:&lt;/p&gt;
&lt;p&gt;Sub New(ByVal orderDate As Date)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Me.New()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;'Set default values&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Me._OrderDate = orderDate&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Me._CustomerID = 1&lt;/p&gt;
&lt;p&gt;End Sub&lt;/p&gt;
&lt;p&gt;Then on your form you could handle the BindingSource.AddingNew event:&lt;/p&gt;
&lt;p&gt;Private Sub OrderBindingSource_AddingNew(ByVal sender As Object, ByVal e As System.ComponentModel.AddingNewEventArgs) Handles OrderBindingSource.AddingNew&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Dim o As New Order(Date.Today)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;e.NewObject = o&lt;/p&gt;
&lt;p&gt;End Sub&lt;/p&gt;
&lt;p&gt;HTH,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#8556786</link><pubDate>Wed, 28 May 2008 20:27:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8556786</guid><dc:creator>Gonzalo Chiriboga</dc:creator><description>&lt;p&gt;Thanks a lot Beth! You are a VB angel.&lt;/p&gt;
&lt;p&gt;TH,&lt;/p&gt;
&lt;p&gt;G&lt;/p&gt;
</description></item><item><title>Beth Massi - Sharing the goodness that is VB : One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#8566934</link><pubDate>Sat, 31 May 2008 20:47:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8566934</guid><dc:creator>Dating</dc:creator><description>&lt;p&gt;In previous posts this month I showed how to use LINQ to SQL classes with a couple different Combobox data binding scenarios. (You can read those articles here and here .) Today I'm going to show you how to create a one-to-many data entry form (and we'l&lt;/p&gt;
</description></item><item><title>Beth Massi - Sharing the goodness that is VB : One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#8575039</link><pubDate>Thu, 05 Jun 2008 14:43:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8575039</guid><dc:creator>Weddings</dc:creator><description>&lt;p&gt;In previous posts this month I showed how to use LINQ to SQL classes with a couple different Combobox data binding scenarios. (You can read those articles here and here .) Today I'm going to show you how to create a one-to-many data entry form (and we'l&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#8592202</link><pubDate>Thu, 12 Jun 2008 00:26:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8592202</guid><dc:creator>pgraves</dc:creator><description>&lt;p&gt;Thanks Beth, Being quite new to Linq I have been grateful for your videos and other help in getting my master details forms working properly. &amp;nbsp;However there is one scenario below in which I am still struggling to get my data to update efficiently.&lt;/p&gt;
&lt;p&gt;I have a form in which the controls on the top half are bound to fields in a table (Vehicles) using LINQ, and the bottom half shows a datagrid with rows from a related table (Vehicle Status).&lt;/p&gt;
&lt;p&gt;A few of the controls in the top half display data from a view which is bound to the Vehicles, and which only shows the most recent records from Vehicle Status - giving information about the current (most recent) status.&lt;/p&gt;
&lt;p&gt;When the vehicle status changes I successfully insert a new row in the vehicle status table, using the sequence: bindingsource.endedit, BindingSource.Add, datacontext.submitchanges, and the new record is saved as the most recent item in the status table. &amp;nbsp;The datagridview refreshes and shows the new data row at the top as expected.&lt;/p&gt;
&lt;p&gt;However the controls in the upper portion of the form which are bound to the 'latest status' view do not refresh to show the new latest status data.&lt;/p&gt;
&lt;p&gt;I am now calling BindingSource.ResetBindings(False) on the vehicles table and the status table as well as calling datacontext.Refresh(Data.Linq.RefreshMode.OverwriteCurrentValues, VehicleBindingSource), all to no avail. &amp;nbsp;Even requerying the data from the database does not refresh the controls on the form. &amp;nbsp;The only way I can refresh this data is by closing and re-loading the form - not the most elegant solution.&lt;/p&gt;
&lt;p&gt;This is now a large application so posting code will be a major operation, however any ideas would be very much appreciated.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Pete&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#8681197</link><pubDate>Wed, 02 Jul 2008 14:58:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8681197</guid><dc:creator>Kim</dc:creator><description>&lt;p&gt;Hi Beth&lt;/p&gt;
&lt;p&gt;Your articles are Great !!!&lt;/p&gt;
&lt;p&gt;Quick Question&lt;/p&gt;
&lt;p&gt;How do delete an individual row from the orderdetails datagridview ?&lt;/p&gt;
&lt;p&gt;Also how can I prevent the user from entering alpha data in a numeric field in the datagridview ? &lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#8762512</link><pubDate>Mon, 21 Jul 2008 23:14:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8762512</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Kim,&lt;/p&gt;
&lt;p&gt;You call the OrderDetailBindingSource.Remove method to delete the current row. The DataGridView will also delete a row if you select the row header on the left and then press the delete key.&lt;/p&gt;
&lt;p&gt;Check out this topic (and related resources at the bottom) for info on formatting data in the DataGridView: &lt;a rel="nofollow" target="_new" href="http://msdn.microsoft.com/en-us/library/hezscd0d.aspx"&gt;http://msdn.microsoft.com/en-us/library/hezscd0d.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;HTH,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#8805547</link><pubDate>Sat, 02 Aug 2008 15:34:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8805547</guid><dc:creator>JMSteele</dc:creator><description>&lt;p&gt;Beth, thanks for all your efforts. I'm a big fan.&lt;/p&gt;
&lt;p&gt;I've hesitated bothering you with this recurring problem but it's vexed me no matter how many times I've followed this tutorial either here or in the HDI vid version.&lt;/p&gt;
&lt;p&gt;Most of the time, though not all, the following IndexOutOfRangeException is rasied when I close the form:&lt;/p&gt;
&lt;p&gt; &amp;quot;Index 0 does not have a value at System.Windows.Forms.CurrencyManager.get_Item(Int32 index) at&lt;/p&gt;
&lt;p&gt;System.Windows.Forms.DataGridView.DataGridViewDataConnection.GetError(Int32rowIndex).&amp;quot;&lt;/p&gt;
&lt;p&gt;I'm using VB 2008 Professional on a 64-bit unit, with a target platform of x86. Googling around has failed to help. Perhaps you can point me in the right direction? Please.&lt;/p&gt;
&lt;p&gt;Best wishes,&lt;/p&gt;
&lt;p&gt;Jim&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#8805587</link><pubDate>Sat, 02 Aug 2008 16:17:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8805587</guid><dc:creator>JMSteele</dc:creator><description>&lt;p&gt;Followup: I've managed to stop the error by &amp;nbsp;adding this to the FromClosing event:&lt;/p&gt;
&lt;p&gt;Me.OrderDetailsDataGridView.Refresh()&lt;/p&gt;
&lt;p&gt;I still have no clue as what initially caused the aforementioned error, however. Oh, well. It's working now, anyway.&lt;/p&gt;
&lt;p&gt;Take care,&lt;/p&gt;
&lt;p&gt;Jim&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#8812537</link><pubDate>Sun, 03 Aug 2008 08:13:15 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8812537</guid><dc:creator>JMSteele</dc:creator><description>&lt;p&gt;Okay, now I'm being a nudge, but ...&lt;/p&gt;
&lt;p&gt;Can someone please clear this up for me?: I was given to understand that the LinqToSql class dbml is for one to one relationships only. If one wants to work with one to many relationships, &amp;nbsp;SqlMetal generated class files is the way to go, so the advice goes. &lt;/p&gt;
&lt;p&gt;What am I not understanding properly? Orders to Order Details, as we have in this tutorial, is a one to many relationship, is it not? &lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#8831314</link><pubDate>Mon, 04 Aug 2008 18:46:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8831314</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi JMSteele,&lt;/p&gt;
&lt;p&gt;You can definately represent one-to-many relationships with LINQ to SQL. LINQ to SQL classes are representations of the tables in your database and so the MAPPING is one class = one table. These classes use the database relations to create the one-to-many associations. &lt;/p&gt;
&lt;p&gt;However it is very common in non-trivial applications for the need to map your calsses to multiple underlying tables in the database and that is something that Entity Framework does (which will be released as part of Visual Studio SP1 this summer).&lt;/p&gt;
&lt;p&gt;HTH,&lt;/p&gt;
&lt;p&gt;-Beth&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#8833101</link><pubDate>Tue, 05 Aug 2008 08:29:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8833101</guid><dc:creator>JMSteele</dc:creator><description>&lt;p&gt;Much thanks for the clear response, Beth. Now it makes sense.&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#8845589</link><pubDate>Sun, 10 Aug 2008 06:03:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8845589</guid><dc:creator>Tom</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;First sry for my bad English. You'r tutorials are very good and i learn so much so tnx a lot. I have just one question. How is possible &amp;quot;price&amp;quot; to be in &amp;quot;product&amp;quot; table and when you choose a product you get price to for this product . Then you just put a Quantity and you get total automatically :).&lt;/p&gt;
&lt;p&gt;Tnx for any help and ty for all your tutorials they are best.&lt;/p&gt;
&lt;p&gt;Bye&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#8904852</link><pubDate>Fri, 29 Aug 2008 15:39:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8904852</guid><dc:creator>John</dc:creator><description>&lt;p&gt;I have the exact same problem that Fatih has.&lt;/p&gt;
&lt;p&gt;Any ideas how to solve it?&lt;/p&gt;
&lt;p&gt;I spend a few hours but found no way to overcome this one!&lt;/p&gt;
&lt;p&gt;I quote Fatih:&lt;/p&gt;
&lt;p&gt;&amp;quot;: on a new orderdetail fill in only quantity and price, leave combobox as is.&lt;/p&gt;
&lt;p&gt;2: Try to save. You'll get a warning.&lt;/p&gt;
&lt;p&gt;3: Now highlight this orderdetail we worked on and delete..&lt;/p&gt;
&lt;p&gt;4: Now save again and you get an error about relation violation. After this you cant work with the database anymore.&amp;quot;&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#8938006</link><pubDate>Wed, 10 Sep 2008 02:46:59 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8938006</guid><dc:creator>Russ</dc:creator><description>&lt;p&gt;I spent most of my day working on this issue - finding this article was a life saver. &amp;nbsp;Thank you for your expertise. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;So do you forsee Microsoft adding the ability to specify the ondelete behavior through the user interface in the future?&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#8941289</link><pubDate>Wed, 10 Sep 2008 20:26:18 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8941289</guid><dc:creator>Benoit</dc:creator><description>&lt;p&gt;To : pgraves or people who have the same problem&lt;/p&gt;
&lt;p&gt;I got this same problem for a similar project.. the way i resolve it.. is, i dispose the Datacontext object and recreate an instance of it..&lt;/p&gt;
&lt;p&gt;To : Beth&lt;/p&gt;
&lt;p&gt;Very good work...! i like every screencast you made!&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#8999174</link><pubDate>Tue, 14 Oct 2008 11:20:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8999174</guid><dc:creator>Emmanuel Nuyttens</dc:creator><description>&lt;p&gt;Hi Beth,&lt;/p&gt;
&lt;p&gt;I have a problem with de &amp;quot;Delete&amp;quot; of OrderDetails in the DeleteItem_Click. In my C# code (sorry, i'm not realy into VB.NET), when I click the &amp;quot;Delete&amp;quot; button in the navig. bar, I get the previous order when i check on the currentitem so :&lt;/p&gt;
&lt;p&gt;Order order = (Order)this.orderBindingSource.Current; &lt;/p&gt;
&lt;p&gt;doesn't give me the &amp;quot;deleted&amp;quot; order but the previous one. Then i checked you're VB.NET example and here i got the right (deleted one).&lt;/p&gt;
&lt;p&gt;I hade to change my C# Code as next to make it work:&lt;/p&gt;
&lt;p&gt;private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//The basic idea is that we need to tell the DataContext to delete the child objects anytime an Order is deleted. &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//In this example, I chose to do this by calling DeleteOnSubmit before we call SubmitChanges. &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//I added this code into the Click event handler for the Delete button on the ToolStrip of the form:&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;try&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.Cursor = Cursors.WaitCursor;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// Get the changed Objects&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ChangeSet changeSet = _db.GetChangeSet();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (changeSet.Deletes.Count &amp;gt; 0)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// Check the deleted ones&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;foreach (var deletedOrder in changeSet.Deletes)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// Check first if deleted object is of &amp;quot;Order&amp;quot; type&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (deletedOrder.GetType().Name == &amp;quot;Order&amp;quot;)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Order currentOrder = (deletedOrder as Order);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (currentOrder != null)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// Mark related OrderDetail records for deletion.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;foreach (OrderDetail detail in currentOrder.OrderDetails)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;_db.OrderDetails.DeleteOnSubmit(detail);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;catch (Exception ex)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;MessageBox.Show(ex.Message);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;finally&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.Cursor = Cursors.Default;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt;Any clue ?&lt;/p&gt;
&lt;p&gt;greetz,&lt;/p&gt;
&lt;p&gt;Emmanuel Nuyttens.&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#9003958</link><pubDate>Sat, 18 Oct 2008 02:58:13 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9003958</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Emmanuel ,&lt;/p&gt;
&lt;p&gt;In your situation you may need full control over the order things are deleted. You can solve this very easily. In the form designer select the OrderBindingNavigator and for the DeleteItem property set that to &amp;quot;(none)&amp;quot;. Now we can write the delete manually on the Order and the OrderDetails in the Click event handler. It's the same code as before, but at the end we need to delete the parent order:&lt;/p&gt;
&lt;p&gt;Private Sub BindingNavigatorDeleteItem_Click() _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; Handles BindingNavigatorDeleteItem.Click&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;If Me.OrderBindingSource.Position &amp;gt; -1 Then&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim order As Order = CType(Me.OrderBindingSource.Current, Order)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'Ensure that children are deleted when the parent is deleted&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;For Each detail In order.OrderDetails&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;db.OrderDetails.DeleteOnSubmit(detail)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Next&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'******&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Me.OrderBindingSource.Remove(order)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'******&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End If&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;End Sub&lt;/p&gt;
&lt;p&gt;HTH,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#9010878</link><pubDate>Wed, 22 Oct 2008 11:26:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9010878</guid><dc:creator>Emmanuel Nuyttens</dc:creator><description>&lt;p&gt;Hi Beth,&lt;/p&gt;
&lt;p&gt;Allright, this works smoothly, thx for the quick reply !&lt;/p&gt;
&lt;p&gt;Emmanuel.&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#9010967</link><pubDate>Wed, 22 Oct 2008 13:29:42 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9010967</guid><dc:creator>peter sha</dc:creator><description>&lt;p&gt;Hi Beth,&lt;/p&gt;
&lt;p&gt;Thanks for such great post, it's really helped us to resolve relationship problems we're having in O/R designer.&lt;/p&gt;
&lt;p&gt;Still, we're stuck at the following problem:&lt;/p&gt;
&lt;p&gt;Suppose we have a two level dataGrid (we're using UltraGrid in our project), if while saving a newly added row at the second (child) level, an error occurs from the database (unique key constraint, for example,) and we delete the newly added row (that caused the trouble) and submit the changes again, it throws an error &amp;quot;Unabled to remove a relationship ...&amp;quot;&lt;/p&gt;
&lt;p&gt;However, we can reinitialize the database to get rid off with the error but doing so will detached the Grid from datacontext and any other changes will also be lost.&lt;/p&gt;
&lt;p&gt;It appears to be a bug in Change Tracker not been resolved in SP1 as well since, if we add and immediately delete a new row without calling submit changes in between, everything works fine.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#9011243</link><pubDate>Wed, 22 Oct 2008 18:59:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9011243</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Peter,&lt;/p&gt;
&lt;p&gt;It sounds like the relationship isn't being picked up between parent/child on the client side. Can you make sure your bindingsources are configured properly? Does it work if you use two DataGridViews with bindingsources as I'm doing in this example?&lt;/p&gt;
&lt;p&gt;You may also want to ask your question to the LINQ to SQL forums: &lt;a rel="nofollow" target="_new" href="http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=2035&amp;amp;SiteID=1"&gt;http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=2035&amp;amp;SiteID=1&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;HTH,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#9012841</link><pubDate>Thu, 23 Oct 2008 14:42:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9012841</guid><dc:creator>peter sha</dc:creator><description>&lt;p&gt;Hi Beth,&lt;/p&gt;
&lt;p&gt;Thanks for the reply. The problem has somewhat been caught.&lt;/p&gt;
&lt;p&gt;Actually, we're using parent.child.add(NewRow) procedure since using InsertOnSubmit makes UltraGrid lost one of many newly added rows while it still exists in the data context causing database to fire any &amp;nbsp;validation error infinitely. It seems the Add method creates a child entity only and does not attach it explicitly with data context till submit changes is called.&lt;/p&gt;
&lt;p&gt;Similarly, we're using parent.child.remove(SelectedRow) (since DeleteOnSubmit works only with attached records), which works fine, but if some error occurs while submitting a new record and we remove &amp;nbsp;that row and call submit changes, relationship error occured.&lt;/p&gt;
&lt;p&gt;Now the solution: I've added extra InsertOnSubmit statement (that would attach added row with data context) along with parent.child.add and have replaced parent.child.remove with DeleteOnSubmit and it's been working fine.&lt;/p&gt;
&lt;p&gt;Thanks for that link, it would definitely be helpful.&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#9205178</link><pubDate>Sat, 13 Dec 2008 05:42:25 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9205178</guid><dc:creator>George</dc:creator><description>&lt;p&gt;Hello Beth and thank you for your videos.&lt;/p&gt;
&lt;p&gt;Unfortunately, being visually impaired, they are&lt;/p&gt;
&lt;p&gt;a bit difficult to see.&lt;/p&gt;
&lt;p&gt;I am interested in creating a database application.&lt;/p&gt;
&lt;p&gt;My question to you is, do you know of any text that&lt;/p&gt;
&lt;p&gt;gives step by step instructions on how to use this new&lt;/p&gt;
&lt;p&gt;LINQ to add, edit, update, delete and search?&lt;/p&gt;
&lt;p&gt;I'm interested in the add, edit, update and delete&lt;/p&gt;
&lt;p&gt;being on the form with the search button being able&lt;/p&gt;
&lt;p&gt;to open another form with a grid. There, the user&lt;/p&gt;
&lt;p&gt;can select the record they want and have the first&lt;/p&gt;
&lt;p&gt;form populated with the information for editing.&lt;/p&gt;
&lt;p&gt;Thank you very very very very very much in advance.&lt;/p&gt;
&lt;p&gt;--George&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#9221778</link><pubDate>Mon, 15 Dec 2008 21:19:39 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9221778</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi George,&lt;/p&gt;
&lt;p&gt;There are a lot of good articles on this blog as well as ThinqLinq.com. I'd also read through the walkthroughs in the MSDN Documentation: &lt;a rel="nofollow" target="_new" href="http://msdn.microsoft.com/en-us/library/bb399349.aspx"&gt;http://msdn.microsoft.com/en-us/library/bb399349.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;HTH,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#9470159</link><pubDate>Wed, 11 Mar 2009 09:41:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9470159</guid><dc:creator>Sunil K</dc:creator><description>&lt;p&gt;I have a form containing two DataGridView Controls. &amp;nbsp;DataGridView1 &amp;amp; DataGridView2.&lt;/p&gt;
&lt;p&gt;Northwind Database used.&lt;/p&gt;
&lt;p&gt;//Code&lt;/p&gt;
&lt;p&gt;BindingSource OrdBindingSource = new BindingSource(NorthwindDataSet, &amp;quot;Orders&amp;quot;);&lt;/p&gt;
&lt;p&gt;//&amp;quot;OrderToOrderDetailsRelation&amp;quot; is Parent Child Relationship between Orders &amp;amp; OrderDetails Table filled in the Northwind DataSet.&lt;/p&gt;
&lt;p&gt;BindingSource OrdDetailsBindingSource = new BindingSource(OrdBindingSource, &amp;quot;OrderToOrderDetailsRelation&amp;quot;);&lt;/p&gt;
&lt;p&gt;DataGridView1.DataSource = OrdBindingSource;&lt;/p&gt;
&lt;p&gt;DataGridView2.DataSource=OrdDetailsBindingSource;&lt;/p&gt;
&lt;p&gt;how do i sum Column Values of Expression Column (Total Value) of DataGridView2.&lt;/p&gt;
&lt;p&gt;I want to reflect the sum into a textbox whenever I select different rown in DataGridView1.&lt;/p&gt;</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#9470163</link><pubDate>Wed, 11 Mar 2009 09:52:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9470163</guid><dc:creator>Sunil K</dc:creator><description>&lt;p&gt;in addition I am using Untyped DataSet.&lt;/p&gt;
&lt;p&gt;I have learned from your VB.NET video on How Do I: Video Series.&lt;/p&gt;
&lt;p&gt;the Code Provided with the video is:&lt;/p&gt;
&lt;p&gt;Private Sub CategoriesBindingSource_CurrentChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CategoriesBindingSource.CurrentChanged&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim row As CategoryProductDataSet.CategoriesRow&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;row = CType(CType(Me.CategoriesBindingSource.Current, DataRowView).Row, CategoryProductDataSet.CategoriesRow)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim total = Aggregate Products In Me.CategoryProductDataSet.Products _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Where Products.CategoryID = row.CategoryID AndAlso _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Products.Discontinued = False _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Into Sum(Products.UnitPrice * Products.UnitsInStock)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Me.TextBox1.Text = Format(total, &amp;quot;c&amp;quot;)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;End Sub&lt;/p&gt;
&lt;p&gt;I just Want to know, how do i implement this in my C# Code.&lt;/p&gt;</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#9470872</link><pubDate>Wed, 11 Mar 2009 21:44:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9470872</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Sunil,&lt;/p&gt;
&lt;p&gt;The Aggregate keyword is VB-specific and isn't supported in C#. Instead you have to call the .Sum extension method and pass it a lambda expression. This should help you get started:&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://msdn.microsoft.com/en-us/vcsharp/aa336747.aspx"&gt;http://msdn.microsoft.com/en-us/vcsharp/aa336747.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;HTH,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#9890367</link><pubDate>Wed, 02 Sep 2009 15:40:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9890367</guid><dc:creator>Ben Gu</dc:creator><description>&lt;p&gt;Hi Beth, I have a very tricky question for you. &amp;nbsp;I have a master-detail datagridview and I also want to have some text box related to master dataset and detail dataset to show current value in the datagridview. &amp;nbsp;However, when I run the program (VB.NET), it pops up a running error of &amp;quot;the column doesn't belong to the detail table.&amp;quot; &amp;nbsp;If I just keep the common fields textbox for both dataset, it's ok. &amp;nbsp;Anything outside of the common fields but only with detail dataset, I will see the running error. &amp;nbsp;I wonder if theoretically I just can't bind the textbox to the detail dataset. &amp;nbsp;Thanks. &amp;nbsp;By the way, if possible, this is my email: ben.gu@tpwd.state.tx.us.&lt;/p&gt;</description></item><item><title>re: One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx#9898219</link><pubDate>Wed, 23 Sep 2009 02:17:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9898219</guid><dc:creator>Piyush Varma</dc:creator><description>&lt;p&gt;How do I fetch a default value from the table and assign it to the blank field of a new record for insert in UI after I click Insert New please?&lt;/p&gt;
&lt;p&gt;Alternatively, can I hard code a default value in the insert new row in the UI so that the user can either accept it or change it before inserting it in the database?&lt;/p&gt;
&lt;p&gt;Thank you, Beth.&lt;/p&gt;
</description></item></channel></rss>