Click here to Skip to main content
15,889,877 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
IEnumerable<datarow> Query = from P in db.Coustomer.AsEnumerable() where (P.CoustomerCode == Code && P.Report == report) select P;
            DataTable dt = query.CopyToDataTable<datarow>();


I Got this Error message-
Cannot implicitly convert type 'System.Collections.Generic.IEnumerable<datalayer.coustomer>' to 'System.Collections.Generic.IEnumerable<system.data.datarow>'. An explicit conversion exists (are you missing a cast?)
Posted
Updated 5-Aug-11 8:49am
v3

1 solution

IEnumerable<datarow> Query = (from P in db.Coustomer.AsEnumerable() 
where (P.CoustomerCode == Code && P.Report == report) 
select P).Cast<datarow>();
 
Share this answer
 
v2
Comments
divesh12 5-Aug-11 16:52pm    
thanx i do with this.
IEnumerable<datarow> Query = (from P in db.Coustomer where (P.CoustomerCode == Code && P.Report == report) select P) as IEnumerable<datarow>;
[no name] 5-Aug-11 17:44pm    
You don't need the "as IEnumerable" since the LINQ query already returns IEnumerable

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