|
Thread: Iif
-
Dec 2nd, 2002, 10:34 PM
#1
Thread Starter
Fanatic Member
Iif
IIf(Booking Is Nothing, "Null", Booking.BookingID)
Booking is an object
and i wish to put its BOOKING id in sql string i am building
and this IIF looked to do the job quite nicely in a compact and neat way.
but nooo it HAS to evaluate booking.bookingid regardless it booking is nothing or not! (resulting in an error if it is nothing)
doesnt that suck!
what do u think.
-
Dec 2nd, 2002, 10:49 PM
#2
Yeah, well, that's the nature of subs/functions. All expressions are evaluated before being passed into the procedure. You'll find the same issue with any function.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Dec 2nd, 2002, 11:02 PM
#3
Thread Starter
Fanatic Member
Originally posted by crptcblade
Yeah, well, that's the nature of subs/functions. All expressions are evaluated before being passed into the procedure. You'll find the same issue with any function.
yeah but i just wanted to whinge
p.s.
regarding ur sig DAS HUGE!
-
Dec 2nd, 2002, 11:07 PM
#4
Originally posted by SkiNLaB
regarding ur sig DAS HUGE!
I know, I know...but I can't bring myself to change it.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Dec 2nd, 2002, 11:11 PM
#5
Fanatic Member
Re: Iif
Originally posted by SkiNLaB
IIf
doesnt that suck!
what do u think.
Yes! I finally found a use for Ilf in one of my programs this past week. It worked out great but even Microsoft warns of its use in MSDN. You definatly have to be careful because of how it evalutes both expressions it is testing!
"Look! Up in the sky! It's a bird! It's a plane! It's Diaper-Head Boy! (there by my name!) Yes, Diaper-Head Boy, who disguised as my son, Seth, fights a never-ending battle for truth, justice and terrorizing my house!
Resistance is futile, you will be compiled . . . Please!
-
Dec 2nd, 2002, 11:13 PM
#6
You think IIf is bad, start using Switch, where you have a a whole lot of params you can pass in and screw up on.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Dec 3rd, 2002, 12:49 AM
#7
Thread Starter
Fanatic Member
/me endeavours to use switch in the near future
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|