I would like to UCASE or ToUpper a column in my LINQ query.
var query = from rsn in db.RSLReasons
orderby rsn.REFCMNT
select new {rsn.REFCODE, rsn.REFCMNT};
dtReasons = query.ToADOTable(rec => new object[] { query });
If I try to run the following code:
var query = from rsn in db.RSLReasons
orderby rsn.REFCMNT
select new {rsn.REFCODE, rsn.REFCMNT.ToString()};
dtReasons = query.ToADOTable(rec => new object[] { query });
I get the following error message on compile:
Invalid anonymous type member
declarator. Anonymous type members
must be declared with a member
assignment, simple name or member
access.
Use
ToUpper()… but you will need to specify the property name in the anonymous type because it can no longer be inferred.