Solved

Example of  VB Linq to SQL one to many update

Posted on 2011-03-07
4
560 Views
Last Modified: 2012-05-11
Does anyone have a good example of how to update a one to many relationship using Linq to SQL in VB?  I can get the parent table updated but am having trouble updating the child tables.  I know how to do it using ASP.NET and love using L2Q in it.  Am now trying to learn the nuances in the syntax for a VB.NET application.  Have been searching the Net for a while on this but haven't found a good explanation.
Thanks for any help in this.
0
Comment
Question by:McGurk1
  • 3
4 Comments
 
LVL 22

Expert Comment

by:plusone3055
ID: 35063324
0
 

Author Comment

by:McGurk1
ID: 35069952
Thanks for the reply.  I searched thru that page yesterday and could find nothing on a many to 1 update or insert.  I will check it out again tho.
0
 

Accepted Solution

by:
McGurk1 earned 0 total points
ID: 35072495
Figured out the insert:
dim db as mydatacontext
dim parent  as new parenttable With _ 
  {.ID = myID, _
   .fieldTwo = textbox2.text, _
    .fieldThree = textbox3.text}

dim child  as new childttable With _ 
  {.childfield1 = textbox4.text, _
    .childfield2 = textbox5.text}

parent.childtables.add(child)
db.parenttables.insertonsubmit(parent)

Open in new window

0
 

Author Closing Comment

by:McGurk1
ID: 35178815
Figured out without EE help
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

762 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

19 Experts available now in Live!

Get 1:1 Help Now