forum

Home / DeveloperSection / Forums / How do I get a single row from a linq expression in C#?

How do I get a single row from a linq expression in C#?

Norman Reedus173517-Feb-2015

This code is supposed to get a DateTime from a linq expression.

DateTime orderDate = (from order in db.Orders where order.Id == orderRules.OrderId select order.DatumTijd).SingleOrDefault();
Instead I get this errorMessage:
'System.Data.Entity.Core.EntityCommandExecutionException' occurred in EntityFramework.SqlServer.dll but was not handled in user code

What could be wrong?


Updated on 17-Feb-2015

Can you answer this question?


Answer

1 Answers

Liked By