cnd
cnd

Reputation: 33784

Errors translating Linq expression to URI: The method 'Select' is not supported

Here is my failing code

        var query = from gg in Client.wcf.context.Good
                    from cc in Client.wcf.context.Customer
                    from ch in Client.wcf.context.CashHeading
                    from cs in Client.wcf.context.Cash
                    where ch.Id_customer == cc.Id
                    where cs.Id_cashheading == ch.Id
                    where gg.Id == cs.Id_good
                    select new CustomerOrderResult {
                        CustomerID = cc.Id,
                        Price = gg.Price.HasValue ? gg.Price.Value : 0,
                        Date = ch.Date.HasValue ? ch.Date.Value : DateTime.Now
                    };
        List<CustomerOrderResult> qqq = query.ToList();

Additional information: The method 'Select' is not supported.

and this solves the error : Why this Linq doesn't work (Error translating Linq expression to URI: Can only specify query options (orderby, where, take, skip)

query is another linq and in total it's WCF Data client to Server (Entity) application full source file is Here, on GitHub

other linq queries there work fine

error : + query {Error translating Linq expression to URI: The method 'Select' is not supported.} System.Linq.IQueryable<CustomerOrderResult> {System.Data.Services.Client.DataServiceQuery<CustomerOrderResult>.DataServiceOrderedQuery}

Upvotes: 3

Views: 2983

Answers (1)

Henrik
Henrik

Reputation: 23324

Probably query contains null. Try

where x != null && x.CustomerID == c.Id 

Upvotes: 1

Related Questions