Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Showing related data in the Navigation Grid
Message
From
23/11/2012 16:03:16
 
 
To
All
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Title:
Showing related data in the Navigation Grid
Miscellaneous
Thread ID:
01557884
Message ID:
01557884
Views:
65
Hi,

I have two related tables: Areas and Routes. An Area is assigned to a Route and a Route can have many Areas assigned.

I have an Area form in which I list all the areas in a data grid (this is WPF C# .NET 3.5). I want to list the Route that each area belongs to in this grid as well. My code to pull back all the Areas is this:
IQueryable<AreaEntity> query = from Area in this.ObjectContext.AreaEntitySet
                                               select Area;
I have tried this:
IQueryable<AreaEntity> query = from Area in this.ObjectContext.AreaEntitySet
                                           join Route in this.ObjectContext.RouteEntitySet on Area.are_rtefk equals Route.rte_pk
                                           select Area, Route;
which gives me this error:

A local variable named 'Route' cannot be declared in this scope because it would give a different meaning to 'Route', which is already used in a 'child' scope to denote something else

I would actually like something like this:
IQueryable<AreaEntity> query = from Area in this.ObjectContext.AreaEntitySet
                                           join Route in this.ObjectContext.RouteEntitySet on Area.are_rtefk equals Route.rte_pk
                                           select Area, Route.rte_name;
to just pull out the rte_name field, but that gives me this error:

Only assignment, call, increment, decrement, and new object expressions can be used as a statement

Anyone can help this linq and .net newbie?
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Next
Reply
Map
View

Click here to load this message in the networking platform