how to on convert sql to linq?

how to convert sql to linq

  • using ef4 iam trying to convert this sql to linq but could not select s.IdSimcard ,s.Imei from dbo.SimCard s where s.Imei not in (select distinct d.Imei from dbo.SimCard d inner join dbo.Configuracion c on c.SinCard_IdSincard = d.IdSimcard where c.Estado = 'Activo' ) So far I have this with the help of linqpad, I cant use linquer anymore for the activation code (from s in SimCard where s.Imei.Contains( (from c in Configuracion join d in SimCard on c.SinCard_IdSincard equals d.IdSimcard where c.Estado == "Activo" select new { d.Imei }).Distinct()) select new { s.IdSimcard, s.Imei }) I have read "Not in" dont supported in EF4, what woul be the equivalent? i get this error in linqpad 'string.Contains(string)' - Argument 1: cant convert de 'System.Linq.IQueryable' to 'string'

  • Answer:

    If I understand your question, you can use the Except(...) Extension method (in the System.Linq namespace) instead of Not Contains(...).

Diego_DX at Stack Overflow Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.