Solved

Example of  VB Linq to SQL one to many update

Posted on 2011-03-07
4
566 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

773 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