I have 3 tables:
CustomerType
CusIDEventType
EventTypeIDCustomerEventType
CusID
EventTypeID
How to Insert one to many relationship using checkboxlist in VB.NET, LINQ to SQL?
dim newEventType = new EventType
newEventType.EventID = 1
db.EventType.InsertOnSubmit(newEventType)
db.submitchange()
Then I want it to automatically insert data into CustomerEventType
table based on the last EvenTypeID data that's just inserted and the checks of the CusID that is using CheckBoxList1
bounded from CustomerType
(Suppose there are 2 IDs).
After I click on Insert button the data in EventType table and CustomerEventType table should be:
EventType
EventTypeID
1
CustomerEventType
EventTypeID.....CusID
1........................1
1........................2
The only question that I have is, what should be the code behind the insert button using VB.NET LINQ-to-SQL to get this result?