Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2643
  • Last Modified:

check for null in linq to sql

If query one table in linq to sql; how can I check if one fileld (an image field set to binary in dbml) is null or empty.

So say something like this

var results = from p in mycontext
                    where p.ID == _itemId  && p.photograph <> null
                       select p.photograph ;    
0
mugsey
Asked:
mugsey
  • 2
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
IS NOT NULL
instead of <> NULL
0
 
mugseyAuthor Commented:
Thanks but this does not let me

The photograph field of of type BYTE so I need to check if there is nothing in that field
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
please try this:

var results = from p in mycontext
                    where p.ID == _itemId  && p.photograph != null
                       select p.photograph ;     

Open in new window

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now