转换完成时出现运行时错误。如何解决?
public spc GetSc(int ID)
{
var SC = from items in db.Stable where items.id== ID orderby items.id select items;
SC.Cast<spc>();
return (spc)SC; // This line throws the error
}
错误信息:
Unable to cast object of type
'System.Data.Entity.Infrastructure.DbQuery`1[Tool.Models.Transaction.spc]'
to type 'Tool.Models.Transaction.spc'.