Solved

check for null in linq to sql

Posted on 2008-10-08
3
2,630 Views
Last Modified: 2013-11-11
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
Comment
Question by:mugsey
  • 2
3 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 22667108
IS NOT NULL
instead of <> NULL
0
 

Author Comment

by:mugsey
ID: 22667124
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
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 22667137
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

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

837 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question