Click here to Skip to main content
15,116,253 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I made a LINQ to SQL class. When I use this class I find some tables appears as normal tables and I can select any field in it

Some other tables appear as Entity Set<tablename> and I can't read its field it display the methods in the table like add firt and single

So what is the problem?

Thanks in advance
Emad
Posted
Updated 2-Feb-10 10:14am
v3

1 solution

When you do a Linq to SQL you get a DataContext (similar to database), which contain tables (similar to DB tables). When you do a dataContext.Products.Where(p=>p.Price>100) you get Entity Set (like record set or sub query). You can read them by using loops or you can convert them to List by doing a ToList(). You can't add a new record to a sub query. You should add to table Products or delete from it.
   

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




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900