That LINQ Error...

In today's webcast on LINQ in C# we looked at joining XML data with SQL Server and we got the error "Local sequence cannot be used in LINQ to SQL implementation of query operators except the Contains() operator" when we tried to run it. Looking deeper into what happened, it appears that the order in which collections are joined in LINQ is important. The original code looked like this:

image

What I found is that we need to specify that we're working with the XML resultset v in venues first and then join to e in events...basically reverse the order that the joined set linqs the two:

image

Weird...