Concatenate int and string in LINQ
Posted
by Waheed
on Stack Overflow
See other posts from Stack Overflow
or by Waheed
Published on 2010-04-21T10:57:55Z
Indexed on
2010/04/21
12:23 UTC
Read the original article
Hit count: 986
entity-framework
|LINQ
HI, I am using the following code
from c in Country
where c.IsActive.Equals(true)
orderby c.CountryName
select new
{
countryIDCode = c.CountryID + "|" + c.TwoDigitCode,
countryName = c.CountryName
}
but following is the error while doing this...
Unable to cast the type 'System.Int32' to type 'System.Object'. LINQ to Entities only supports casting Entity Data Model primitive types.
CountryID is int
type and TwoDigitCode
is string type.
Can u please let me know how to concatenate....
Thanks....
© Stack Overflow or respective owner