Problem in returning teh null value from money type [modified]
-
Hi, I have a numeric type field in database. Which returns null value. In my following linq query i Dim query as integer= (From P In objbase.GetTable(Of table)() Where P.ID1 = Id1 And P.CID1 = CId1 Select IIf(P.Fee is nothing,0,P.Fee)).SingleOrDefault It is throwing fllowing exception. The IIF method returns two separate types: Int32, Nullable`1. Translation to SQL does not support different return types. Please help
modified on Wednesday, March 18, 2009 2:15 AM
-
Hi, I have a numeric type field in database. Which returns null value. In my following linq query i Dim query as integer= (From P In objbase.GetTable(Of table)() Where P.ID1 = Id1 And P.CID1 = CId1 Select IIf(P.Fee is nothing,0,P.Fee)).SingleOrDefault It is throwing fllowing exception. The IIF method returns two separate types: Int32, Nullable`1. Translation to SQL does not support different return types. Please help
modified on Wednesday, March 18, 2009 2:15 AM
remove the IIF singleOrDefault will do the trick for you. Default(int) is 0
Abhishek Sur My Latest Articles Basics on LINQ and Lambda Expressions
Create .NET Templates -
remove the IIF singleOrDefault will do the trick for you. Default(int) is 0
Abhishek Sur My Latest Articles Basics on LINQ and Lambda Expressions
Create .NET TemplatesHi, I did, As suggested by you. But, I am getting the same crash for the following query Dim query as integer= (From P In objbase.GetTable(Of table)() Where P.ID1 = Id1 And P.CID1 = CId1 Select P.Fee).SingleOrDefault