Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Showing related data in the Navigation Grid
Message
De
23/11/2012 16:03:16
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Titre:
Showing related data in the Navigation Grid
Divers
Thread ID:
01557884
Message ID:
01557884
Vues:
64
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform