View Single Post
  #126 (permalink)  
Old 09-26-2007, 08:21 AM
H2o H2o is offline
D-Web Analyst
 
Join Date: Jul 2007
Posts: 246
H2o is on a distinguished road
Thumbs up Re: ASP.NET Data Controls

hi,

No worries!!
I think you might be getting confused here!! There aren't any "IIF functions" as you describe them.
IIF is a function which compacts a normal
IF condition THEN
condition_is_true_value
ELSE
condition_is_false_value
END IF
into 1 line... so really it's about understanding how the 3 component parts work... and getting your logic right!!
So in your case with IIf(condition, true_value, false_value) you're comfortable with the true_value and false_value, but not building the condition itself.
Well the condition can be any VB you want... in this case you could've written your own function that checks to see if the value is DBNull or String.Empty and then returns a Boolean... and then called that.
Instead I put the logic inline for you with judicious use of OrElse... this is something that is very important to understand...
statement1 And statement2 - this means that both statement1 and statement2 will be evaluated and both must be true
statement1 Or statement2 - this means that both statement1 and statement2 will be evaluated and either one must be true
statement1 AndAlso statement2 - this means that both statement1 and statement2 must be true, but if statement1 is false statement2 is not evaluated
statement1 And statement2 - this means that either statement1 or statement2 must be true, but if statement1 is true statement2 is not evaluated
Hope this all makes sense!
__________________
H2O

Without us, no one can survive..
Reply With Quote