This is a migrated thread and some comments may be shown as answers.

LINQ statement shows as error

2 Answers 41 Views
Code Analysis
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Kevin F
Top achievements
Rank 1
Kevin F asked on 27 Apr 2010, 10:22 PM
I get a "C#: This expression is not a valid statement" with the attached code.  The first error that shows up is "C#: Missing ';'" The red line starts right after the join keyword.

var leinAssocResults = 
                from l 
                in (leinDb.tblLEIN_LEINs) 
                join lar in (leinDb.tblLEIN_Associates.Where(leinAssocPredicate)) 
                on l.LEINNUM equals lar.LEINNUM 
                orderby l.Sort_Num descending 
                select new 
                { 
                    lar.LNAME, 
                    lar.FNAME, 
                    lar.LEINNUM, 
                    lar.DOB, 
                    l.DISSEMINAT, 
                    lar.TYPE, 
                    lar.SEX, 
                    lar.RACE 
                }; 

Any ideas?

Thanks!

2 Answers, 1 is accepted

Sort by
0
Kevin F
Top achievements
Rank 1
answered on 27 Apr 2010, 11:26 PM
Found the problem.  JustCode did not like the parens; below works fine.
var leinAssocResults =  
                from l  
                in leinDb.tblLEIN_LEINs 
                join lar in leinDb.tblLEIN_Associates.Where(leinAssocPredicate) 
                on l.LEINNUM equals lar.LEINNUM  
                orderby l.Sort_Num descending  
                select new  
                {  
                    lar.LNAME,  
                    lar.FNAME,  
                    lar.LEINNUM,  
                    lar.DOB,  
                    l.DISSEMINAT,  
                    lar.TYPE,  
                    lar.SEX,  
                    lar.RACE  
                };  

0
Hans Kratz
Telerik team
answered on 28 Apr 2010, 05:24 PM
Hello Jason,

thanks a lot for your feedback. I could reproduce it and scheduled it for fixing in the Q2 release. You will be automatically notified once it is fixed.

I have awarded you some Telerik points as compensation for your efforts.


Kind regards,
Hans Kratz
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Code Analysis
Asked by
Kevin F
Top achievements
Rank 1
Answers by
Kevin F
Top achievements
Rank 1
Hans Kratz
Telerik team
Share this question
or