Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9
This is the forum to discuss the Wrox book Professional ASP.NET 3.5: In C# and VB by Bill Evjen, Scott Hanselman, Devin Rader; ISBN: 9780470187579
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old March 1st, 2009, 07:12 PM
Registered User
 
Join Date: Mar 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Insert data using LINQ SQL - page 471

Greetings - I used the code on page 471 to insert data using a stored procedure. I am trying to insert into 3 tables. The code works, but it only inserts data into the first table (Member). It creates a record in the other two tables (MemberCompany and MemberDemographic) with an ID that matches the first table (Member), but does not insert the data (the fields are NULL). I would appreciate any help to correct this - thanks!

Code:
 
ProtectedSub Page_Load(ByVal sender AsObject, ByVal e As System.EventArgs) Handles finish.ServerClick
 
Dim dc AsNew MemberDataClassesDataContext()
 
Dim mobjMember AsNew Member With {.FirstName = Trim(FirstName.Value), _
.LastName = Trim(LastName.Value), _
.GenderID = Trim(rblGender.SelectedItem.Value), _
.Address = Trim(Address.Value), _
.City = Trim(City.Value), _
.State = Trim(State.Value), _
.ZipCode = Trim(ZipCode.Value), _
.PhoneNumber = Trim(PhoneNumber.Value), _
.EmailAddress = Trim(EmailAddress.Value), _
.MembershipTypeID = Trim(rblMembershipType.SelectedItem.Value), _
.SendMailTypeID = Trim(rblSendMailTo.SelectedItem.Value), _
.SendEmailTypeID = Trim(rblSendEmailTo.SelectedItem.Value), _
.ReferredBy = Trim(ReferredBy.Value), _
.DateTime = Today(), _
.RegistrationDate = Today(), _
.ShareInformation = (chkShareInformation.Checked)}
 
'Set member company properties.
Dim MemberCompany AsNew MemberCompany With {.CoName = Trim(CoName.Value), _
.JobTitle = Trim(JobTitle.Value), _
.CoAddress = Trim(CoAddress.Value), _
.CoCity = Trim(CoCity.Value), _
.CoState = Trim(CoState.Value), _
.CoZipCode = Trim(CoZipCode.Value), _
.CoPhoneNumber = Trim(CoPhoneNumber.Value), _
.CoEmailAddress = Trim(CoEmailAddress.Value)}
 
'Set member demographic properties.
Dim MemberDemographic AsNew MemberDemographic With {.EducationLevel = Trim(rblEducationLevel.SelectedItem.Value), _
.WorkedInTechnology = Trim(rblWorkedInTechnology.SelectedItem.Value), _
.Degrees = Trim(rblDegrees.SelectedItem.Value)}
 
dc.Members.InsertOnSubmit(mobjMember)
dc.SubmitChanges()
Response.Redirect("PayJoin.aspx")
EndSub
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple Row Insert using Linq arivarasuk ASP.NET 3.5 Professionals 1 January 9th, 2009 10:21 AM
confusing in ADO.NET Entity Data Model,Linq to sql angelboy ADO.NET 5 November 21st, 2008 04:01 PM
INSERT Data to SQL Database Lofa ASP.NET 1.0 and 1.1 Basics 1 February 22nd, 2006 02:09 AM
Check before insert data into sql Alcapone C# 2 October 26th, 2004 07:57 AM



All times are GMT -4. The time now is 10:53 PM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.