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. Database & SysAdmin
  3. Database
  4. isnull in linq where condition

isnull in linq where condition

Scheduled Pinned Locked Moved Database
databasecsharplinqtutorial
3 Posts 3 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.
  • Y Offline
    Y Offline
    yesu prakash
    wrote on last edited by
    #1

    Hi, How to write isnull(exp1,exp2) in the where condition of linq. eg; SQL: ... where userpk = isnull(@userpk,userpk) i need to convert the above query to linq Thankyou, Yesuprakash

    J N 2 Replies Last reply
    0
    • Y yesu prakash

      Hi, How to write isnull(exp1,exp2) in the where condition of linq. eg; SQL: ... where userpk = isnull(@userpk,userpk) i need to convert the above query to linq Thankyou, Yesuprakash

      J Offline
      J Offline
      Johan Hakkesteegt
      wrote on last edited by
      #2

      http://forums.asp.net/t/1329095.aspx/1[^]

      My advice is free, and you may get what you paid for.

      1 Reply Last reply
      0
      • Y yesu prakash

        Hi, How to write isnull(exp1,exp2) in the where condition of linq. eg; SQL: ... where userpk = isnull(@userpk,userpk) i need to convert the above query to linq Thankyou, Yesuprakash

        N Offline
        N Offline
        Niladri_Biswas
        wrote on last edited by
        #3

        This may help

        where
        !string.IsNullOrEmpty(record.Field("userpk"))
        ? record.Field("userpk")
        : null

        Niladri Biswas

        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