Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. LINQ
  4. Problem in returning teh null value from money type [modified]

Problem in returning teh null value from money type [modified]

Scheduled Pinned Locked Moved LINQ
databasehelpcsharplinq
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Pankaj Garg
    wrote on last edited by
    #1

    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

    A 1 Reply Last reply
    0
    • P Pankaj Garg

      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

      A Offline
      A Offline
      Abhishek Sur
      wrote on last edited by
      #2

      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

      P 1 Reply Last reply
      0
      • A Abhishek Sur

        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

        P Offline
        P Offline
        Pankaj Garg
        wrote on last edited by
        #3

        Hi, 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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups