LINQ Data type mismatch RRS feed

  • Question

  • The following statement is in my stored procedure. In the LINQ designer, I am expecting that 'IsON' field to be mapped using datatype bool, but I get the data type as string in LINQ class. I tried 'True' and 1 also in the CASE statement but I am not getting the bool data type.

    How can I get the data type in LINQ class as bool? Any other alternative to write the statement?

       WHEN DATEDIFF(DAY,GETUTCDATE(),T1.ExpiryDate) > 0 THEN 'true'
       ELSE 'false'
       END IsON
    FROM myTable T1

    Thanks in advance

    Wednesday, April 14, 2010 6:39 PM


  • I found one option which works as, Any better way if someone can suggest . I don't know if the option I have will perform good.


    THEN CAST(1 AS BIT) instead of THEN 'true'

    • Marked as answer by KJian_ Tuesday, April 20, 2010 12:11 PM
    Wednesday, April 14, 2010 6:47 PM