This is what my entities look like:
I'm essentially trying to make a left outer join between LookupMakeModel and LookYearMakeModel for a given year. I plan on selecting a valid year from a dropdownlist and then showing a table of all the records in LookMakeModel and checking the checkbox for the LookMakeModels that have a record in LookYearMakeModel for the given year.
Data Sample:
____________________________ __________________________________
| LookupMakeModel | | LookupYearMakeModel |
|---------------------------- |---------------------------------
|Make | Model | Submodel| |Year |Make | Model | Submodel|
|---------------------------- |----------------------------------
|Ford | Mustang | 5.0 | |2010 | Ford | Mustang|5.0 |
|Ford | Mustang | 4.0 | |2010 | Ford | Mustang| 4.0 |
|Ford | Explorer| 2wd | _________________________________
|Ford | Explorer| 4wd |
____________________________
Query Result for the year 2010 would be like this:
|-----------------------------------
|YearChecked|Make | Model | Submodel|
|------------------------------------
|Yes |Ford | Mustang | 5.0 |
|Yes |Ford | Mustang | 4.0 |
|No/Null |Ford | Explorer| 2wd |
|No/Null |Ford | Explorer| 4wd |
_____________________________________
Here's what I have so far:
Dim SelectedYear = ddlYear.SelectedValue
Dim Query2 = From p In gDataContext.LookupMakeModels
Select New With _
{
.Make = p.Make,
.Model = p.Model,
.Submodel = p.Submodel,
.YearChecked = ?????
}
Thanks for your help!