The specified type member ‘Date’ is not supported in LINQ to Entities Exception

You can use the TruncateTime method of the EntityFunctions to achieve a correct translations of the Date property into SQL: using System.Data.Objects; // you need this namespace for EntityFunctions // … DateTime ruleData = Convert.ToDateTime(rule.data).Date; return jobdescriptions .Where(j => EntityFunctions.TruncateTime(j.JobDeadline) == ruleData); Update: EntityFunctionsis deprecated in EF6, Use DbFunctions.TruncateTime

Like Operator in Entity Framework?

I don’t know anything about EF really, but in LINQ to SQL you usually express a LIKE clause using String.Contains: where entity.Name.Contains(“xyz”) translates to WHERE Name LIKE ‘%xyz%’ (Use StartsWith and EndsWith for other behaviour.) I’m not entirely sure whether that’s helpful, because I don’t understand what you mean when you say you’re trying to … Read more

How to compare only date components from DateTime in EF?

Use the class EntityFunctions for trimming the time portion. using System.Data.Objects; var bla = (from log in context.Contacts where EntityFunctions.TruncateTime(log.ModifiedDate) == EntityFunctions.TruncateTime(today.Date) select log).FirstOrDefault(); Source: http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/84d4e18b-7545-419b-9826-53ff1a0e2a62/ UPDATE As of EF 6.0 and later EntityFunctions is replaced by DbFunctions.

LINQ to Entities case sensitive comparison

That’s because you are using LINQ To Entities which is ultimately convert your Lambda expressions into SQL statements. That means the case sensitivity is at the mercy of your SQL Server which by default has SQL_Latin1_General_CP1_CI_AS Collation and that is NOT case sensitive. Using ObjectQuery.ToTraceString to see the generated SQL query that has been actually … Read more

LINQ to Entities does not recognize the method

As you’ve figured out, Entity Framework can’t actually run your C# code as part of its query. It has to be able to convert the query to an actual SQL statement. In order for that to work, you will have to restructure your query expression into an expression that Entity Framework can handle. public System.Linq.Expressions.Expression<Func<Charity, … Read more

Only parameterless constructors and initializers are supported in LINQ to Entities

without more info on ‘Payments’ this doesn’t help much, but assuming you want to create a Payments object and set some of its properties based on column values: var naleznosci = (from nalTmp in db.Naleznosci where nalTmp.idDziecko == idDziec select new Payments { Imie = nalTmp.Dziecko.Imie, Nazwisko = nalTmp.Dziecko.Nazwisko, Nazwa= nalTmp.Miesiace.Nazwa, Kwota = nalTmp.Kwota, NazwaRodzajuOplaty … Read more

New transaction is not allowed because there are other threads running in the session LINQ To Entity [duplicate]

The pp variable isn’t a collection of objects, it’s an enumerator that can return objects. While you use the enumerator, the source has to remain open. Use the ToList method to realise the enumerator into a collection. That will read all items from the enumerator and close the connection to the source, so that you … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)