Solved

Example of  VB Linq to SQL one to many update

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Setting runtime form location 4 29
update textboxes with Streamreader 21 42
Allow User To Arrange Columns At Datagridview 3 19
C# Single Form 8 27
Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
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 gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

910 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

23 Experts available now in Live!

Get 1:1 Help Now