473,395 Members | 1,452 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

iif not working

hey all,

i'm using an iif and it's not working how I think it should work (go figure).
Anyway,

IIf(IsNothing(Request.QueryString("Sd")), Me.sortDir = "asc",
Request.QueryString("Sd"))

When i run this the expression evaluates as true but the true part doesn't
happen for some reason. It's like it's broke or something.

Does anyone have Bill Gates' home phone number? I really need to ask him
about this one.

thanks,
rodchar
Nov 19 '05 #1
4 1109
That is because in the True part, you are doing a comparison to a string.
You should expect that will result in True or False.

What are you expecting exactly? Can you please provide complete details on
what you expect to happen and what is happening, as well as the value of all
variables involved.

"rodchar" <ro*****@discussions.microsoft.com> wrote in message
news:A2**********************************@microsof t.com...
hey all,

i'm using an iif and it's not working how I think it should work (go
figure).
Anyway,

IIf(IsNothing(Request.QueryString("Sd")), Me.sortDir = "asc",
Request.QueryString("Sd"))

When i run this the expression evaluates as true but the true part doesn't
happen for some reason. It's like it's broke or something.

Does anyone have Bill Gates' home phone number? I really need to ask him
about this one.

thanks,
rodchar

Nov 19 '05 #2
i thought i was doing an assignment statement?
"Marina" wrote:
That is because in the True part, you are doing a comparison to a string.
You should expect that will result in True or False.

What are you expecting exactly? Can you please provide complete details on
what you expect to happen and what is happening, as well as the value of all
variables involved.

"rodchar" <ro*****@discussions.microsoft.com> wrote in message
news:A2**********************************@microsof t.com...
hey all,

i'm using an iif and it's not working how I think it should work (go
figure).
Anyway,

IIf(IsNothing(Request.QueryString("Sd")), Me.sortDir = "asc",
Request.QueryString("Sd"))

When i run this the expression evaluates as true but the true part doesn't
happen for some reason. It's like it's broke or something.

Does anyone have Bill Gates' home phone number? I really need to ask him
about this one.

thanks,
rodchar


Nov 19 '05 #3
IIF is a function. You are passing parameters to that function. Whenever
there is a method call, all the arguments are evaluated. Meaning the = sign
will be treated as a comparison operator, not the assignment operator.

Not only that, but all the arguments will be evaluated no matter if the
condition that is the first argument is true or false. This is because IIF
is not a language construct - it is a function. So all arguments will be
evaluated before they are called. This is unlike constructs in C#,
javascript, and other languages where there is an actual language construct
for this that evaluates the true part or false part only if necessary.

"rodchar" <ro*****@discussions.microsoft.com> wrote in message
news:EE**********************************@microsof t.com...
i thought i was doing an assignment statement?
"Marina" wrote:
That is because in the True part, you are doing a comparison to a string.
You should expect that will result in True or False.

What are you expecting exactly? Can you please provide complete details
on
what you expect to happen and what is happening, as well as the value of
all
variables involved.

"rodchar" <ro*****@discussions.microsoft.com> wrote in message
news:A2**********************************@microsof t.com...
> hey all,
>
> i'm using an iif and it's not working how I think it should work (go
> figure).
> Anyway,
>
> IIf(IsNothing(Request.QueryString("Sd")), Me.sortDir = "asc",
> Request.QueryString("Sd"))
>
> When i run this the expression evaluates as true but the true part
> doesn't
> happen for some reason. It's like it's broke or something.
>
> Does anyone have Bill Gates' home phone number? I really need to ask
> him
> about this one.
>
> thanks,
> rodchar


Nov 19 '05 #4
thank you this helped.

"Marina" wrote:
IIF is a function. You are passing parameters to that function. Whenever
there is a method call, all the arguments are evaluated. Meaning the = sign
will be treated as a comparison operator, not the assignment operator.

Not only that, but all the arguments will be evaluated no matter if the
condition that is the first argument is true or false. This is because IIF
is not a language construct - it is a function. So all arguments will be
evaluated before they are called. This is unlike constructs in C#,
javascript, and other languages where there is an actual language construct
for this that evaluates the true part or false part only if necessary.

"rodchar" <ro*****@discussions.microsoft.com> wrote in message
news:EE**********************************@microsof t.com...
i thought i was doing an assignment statement?
"Marina" wrote:
That is because in the True part, you are doing a comparison to a string.
You should expect that will result in True or False.

What are you expecting exactly? Can you please provide complete details
on
what you expect to happen and what is happening, as well as the value of
all
variables involved.

"rodchar" <ro*****@discussions.microsoft.com> wrote in message
news:A2**********************************@microsof t.com...
> hey all,
>
> i'm using an iif and it's not working how I think it should work (go
> figure).
> Anyway,
>
> IIf(IsNothing(Request.QueryString("Sd")), Me.sortDir = "asc",
> Request.QueryString("Sd"))
>
> When i run this the expression evaluates as true but the true part
> doesn't
> happen for some reason. It's like it's broke or something.
>
> Does anyone have Bill Gates' home phone number? I really need to ask
> him
> about this one.
>
> thanks,
> rodchar


Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Martin Heuckeroth | last post by:
Hi We are working on a webservice application and are having some problems with the cookies and/or sessions. We have them working on our intranet but then its not working on the internet. We...
5
by: tshad | last post by:
I have been working with setting my drop boxes to allow double clicking to select an item. It worked fine until I made some changes. I then stripped the page down to the bare essentials to find...
8
by: jojobar | last post by:
Okay, I am trying to do is to test the webresource in 2.0 1. I created a new project with assembly name (and default assembly name) "Office". 2. I added the following to the AssemblyInfo.cs...
2
by: Don | last post by:
I'm having problems with intellisense, autocomplete, etc. suddenly not working in certain classes of a project I'm working on. All the options are set, and it all works fine for most classes, but...
9
by: MSDNAndi | last post by:
Hi, I have a set of simple webservices calls that worked fine using .NET Framework 1.0. I am calling a Java/Apache based webservices, the calling side is not able to supply a proper WSDL. ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.