0

I have a jump table to relate the Customers and the contact, I want to load all contacts by a customer name. What is the best way to do that?

   Dim Q = From Cust In EnData.Customers Where Cust.CustomerID = ID Select Cust
            ContactRow = Q.FirstOrDefault.CustomerToContacts.??? here I'm stock...

table layout

Ezi
  • 2,212
  • 8
  • 33
  • 60

1 Answers1

1

Try this...

var customerContacts = EnData.CustomerToContact
                           .Where(c => c.Customer.CustName.Equals(custName))
                           .Select(c => c.Contact);

This should return an IQueryable<Contact> containing all of the contacts for the customer with the provided custName. You'll have to convert it to VB as this is in C#, although I assume that should be rather straight forward.

shuniar
  • 2,592
  • 6
  • 31
  • 38