How to get rid of this error in asp.net-mvc?

Posted by Pandiya Chendur on Stack Overflow See other posts from Stack Overflow or by Pandiya Chendur
Published on 2010-04-29T12:42:19Z Indexed on 2010/04/29 12:47 UTC
Read the original article Hit count: 191

Filed under:
|

I am using Linq-to-sql as an ORM. I wrote this innerjoin

public IQueryable<Material> FindAllMaterials()
 {
   var materials=from m in db.Materials
               join Mt in db.MeasurementTypes on m.MeasurementTypeId equals Mt.Id
               select new { m.Mat_id, 
               m.Mat_Name, 
               Mt.Name, 
                m.Mat_Type };

  return materials;
 }

But when i compile this i got an error

Cannot implicitly convert type 'System.Linq.IQueryable<AnonymousType#1>' 
to 'System.Linq.IQueryable<CrMVC.Models.Material>'. 
An explicit conversion exists (are you missing a cast?)

Am i missing some thing... Any suggestion....

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about linq-to-sql