Link to home
Start Free TrialLog in
Avatar of Camillia
CamilliaFlag for United States of America

asked on

Simple LINQ select statement

What's wrong with this LINQ? I get 6 errors; "; expected" and "invalid expression term in".

I think the syntax is correct. I have using Sytem.LINQ on top of the page. I have also imported the namespace that contians the LINQ context.

EContext dc = new EContext();
 
        var p = from c in dc.LSite //error here under "c", under "in" and under "dc"
                where c.Code != "GBL"  //error here looking for ; at the end.
                select c;
 
        foreach (var values in p)
        {
            lbSites.Attributes.Add(values.Code, values.Name);
        }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of naspinski
naspinski
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Camillia

ASKER

let me try and will post back. Thanks
you were right ...  i changed to "equal" but that "c" was also giving an error. Changed it and it works. Thanks.