Click here to Skip to main content
15,888,330 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
please help me
i have this error in my code,i want to use entity framework in n-tier programming:
Error 1 Cannot implicitly convert type 'System.Linq.IQueryable<domain.model.tbl_personinfo>' to 'System.Collections.Generic.List<domain.model.tbl_personinfo>'. An explicit conversion exists (are you missing a cast?)

this is my code:
C#
List<tbl_personinfo> c = marsh.tbl_PersonInfo.Where(k => k.Name.Contains(ss)||k.Family.Contains(ss2));
Posted
Updated 14-Aug-12 1:45am
v2
Comments
amirmohamad 14-Aug-12 6:49am    
i have this problem like you
:D

Try :
SQL
List c = marsh.tbl_PersonInfo.Where(k => k.Name.Contains(ss)
||k.Family.Contains(ss2)).ToList();


Also try :

C#
List<yourobject> x =  marsh.tbl_PersonInfo.Where(delegate(yourobj k) { return k.Contains(ss); }).ToList();</yourobject>
 
Share this answer
 
Comments
daghune 14-Aug-12 7:03am    
thank you alot man
amirmohamad 14-Aug-12 7:06am    
5+
BillW33 14-Aug-12 9:16am    
Another good answer, +5
Kuthuparakkal 22-Aug-12 23:50pm    
thank you all
Add a call to .ToList method at the end of LINQ expression.
 
Share this answer
 
Comments
daghune 14-Aug-12 6:59am    
tanx man ,nice help
amirmohamad 14-Aug-12 7:06am    
5+
BillW33 14-Aug-12 9:16am    
Good answer, +5

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