First off, be sure you have added the right references to your project. You'll
need a using statement for System.Linq.
Looking at your LINQ code, It may be just your extra ) in there. Do you
have your foreign key relationships defined (the p.ID = s.ID) in the designer?
If so, the additional "join" shouldn't be necessary.
var query =
from p in people.People
select new { p.LastName, p.FirstName, p.Salaries.Year, p.Salaries.SalaryYear
};
If not, then your query looks good, but it'd be based on the data layout
you have designed.
var query =
from p in people.People
from s in people.Salaries
where p.ID == s.ID
select new { p.LastName, p.FirstName, s.Year, s.SalaryYear };
If it still isn't working, could you maybe post up what the actual compiler
error is?
HTH.
-dl
--
David R. Longnecker
http://blog.tiredstudent.com
Hi
I have VS .NET 2005 and I install LinQ preview for C#. I'm try to make
some thing using LINQ.
IT returns error in this sentence :
var query = from p in people.People
from s in people.Salaries
where p.ID == s.ID)
select new { p.LastName, p.FirstName, s.Year,
s.SalaryYear};
And don't recognize this Sintax.
I will be grateful for your help
Pedro