Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Check for NULL or 0 at the same time
Message
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
OS:
Windows XP
Database:
MS SQL Server
Miscellaneous
Thread ID:
01329868
Message ID:
01329873
Views:
15
>Hi everybody,
>
>I have a variable that can be either 0 or NULL or some integer value. Is there a way to check for both conditions 0 and NULL without using OR condition (no LINQ, please, I want compatibility with .NET 2.0)
>
>I have currently
>
>(DataBinder.Eval(Container.DataItem, "SpouseID").ToString() != "") which works correctly for NULL, but doesn't work for 0.
>
>Thanks a lot in advance.

I think I have an answer on my question.
http://weblogs.asp.net/scottgu/archive/2007/09/20/the-new-c-null-coalescing-operator-and-using-it-with-linq.aspx
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform