Click here to Skip to main content
13,298,451 members (55,827 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I cant convert this Query in SQL Server to LINQ

SELECT dbo.ReportType.Name
FROM   dbo.Center INNER JOIN
       dbo.SwitchType ON dbo.Center.ID = dbo.SwitchType.ID FULL JOIN
       dbo.ReportType ON dbo.Center.ID = dbo.ReportType.ID

Pleas help me .
Posted 17-Nov-12 21:11pm
Updated 18-Nov-12 3:11am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

1.Go to sql server and create a [VIEW] and join table's together.
2.Add View to LINQ to SQL
DataClasses1DataContext db = new DataClasses1DataContext();
ViewNameBindingSource.DataSource = db.ViewName.Where(c => c.Name=="KeySearch").Select(c=>c);
//ViewNameBindingSource BindingSource For ReportView 

2)Example By linq
//linq to entities three table join query
var query = from p in db.QuizParticipants
            join points in db.ParticipantPoints on 
            equals points.participantId into participantsGroup
            from po in participantsGroup
            join winners in db.Winners on 
            equals winners.participantId into winnersGroup
            from w in winnersGroup
            where p.hasAttended == 1 && p.weeknumber == weeknumber
            select new
                ParticipantId =,
                HasAttended = p.hasAttended,
                Weeknumber = p.weeknumber, 
                UmbracoMemberId = p.umbMemberId,
                Points = po.points,
                HasWonFirstPrize = w.hasWonFirstPrize,
                HasWonVoucher = w.hasWonVoucher                                    
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

select * from PersonInfo
where code
(select a.Code from PersonInfo as a ,TradeElamieh as b
where a.Code=b.person1 and b.Actual=1 and (a.Investor_ID like'1338%' or a.Investor_ID like'1339%')
 and>'2012-01-01' and a.Investor_ID IS NOT NULL)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.171207.1 | Last Updated 21 Jan 2014
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100