views:

9

answers:

0

I have 3 tables:

CustomerType
CusID

EventType
EventTypeID

CustomerEventType
CusID
EventTypeID

How to create an event type with the selected customer type using checkbox list using LINQ to SQL and VB.NET?

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. )

alt text


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? Please help me out of this problem. Thanks you so much for your time and everything.
May God bless you all.