Leap Bun
Leap Bun

Reputation: 2295

How to use ADO.Net Entity Data Model with two tables?

I have two tables: Student (StuID, Name, Sex, MajorID, ...) and Major (MajorID, MajorName, ...). I would like to get result: StuID, Name, MajorName. How to retrieve this record using ADO.Net Entity Data Model?

Upvotes: 0

Views: 927

Answers (1)

Pongsathon.keng
Pongsathon.keng

Reputation: 1435

I think that you are asking for C# LINQ query, if you are not, please ignore my anwser.

var result = from s in Student 
             join m in Major on s.MajorID equal m.MajorID
             select new {s.StuID, s.Name, m.MajorName}

Upvotes: 1

Related Questions