Click here to Skip to main content
15,884,739 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to get the taxcode, taxname and taxrate as list using linq. But it's showing the following error:
"DbExpressionBinding requires an input expression with a collection ResultType.
Parameter name: input"


UAAPPEntities context;
context=new UAAPPEntities();
var x = from txs in context.OTAXs
        where txs.Code.Count()<=1
        select new TaxModel{ taxCode=txs.Code, taxName=txs.Name,taxRate=txs.Rate.Value };
taxList = x.ToList();
return taxList;


Please help me..

Advance Thanks,
Indhu.
Posted
Comments
Richard Deeming 7-Oct-14 7:54am    
What is the type of the Code property? From the error, it sounds like it's not a collection.
S.Indhu 7-Oct-14 8:07am    
This is a column in the table. This code may be duplicate, But i want to retrieve unique code data only.

1 solution

CSS
hi,

Got solution using the following query:

var x = from t1 in context.OTAXs
                    group t1.Code by new { t1.Code } into g
                    where g.Count()<=1
                    join txs in context.OTAXs on g.Key.Code equals txs.Code
                    select new TaxModel { taxCode = txs.Code, taxName = txs.Code, description = txs.Code, taxRate = txs.Rate.Value };


Happy coding..

Thanks,
Indhu.
 
Share this answer
 
v2

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


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