0

I have the following code:

    public ActionResult Details(int orderId)
    {
        var query = from orderDetails in storeDb.OrderDetails
                    where orderDetails.OrderId = orderId
                    select new { orderDetails.Product, orderDetails.Quantity, orderDetails.UnitPrice };

        return View(query);
    }

I want to get the rows of orderDetails where the foreign key OrderId is equal to the parameter orderId. However I keep getting the following error: Error 2 Cannot implicitly convert type 'int' to 'bool'. What am I missing?

2 Answers 2

8

where orderDetails.OrderId = orderId

Needs to be

where orderDetails.OrderId == orderId

Sign up to request clarification or add additional context in comments.

1 Comment

@Seth since this is the right answer you should mark it as the answer.
0
where orderDetails.OrderId == orderId

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.