Ask a Question related to ASP Database, Design and Development.
-
Rafe Harwood #1
Re: Confusing confitional statement
ok.. so if thats the issue, then the original
if optiondone<>"" then response.write "" else response.write "<br />"
because if it wasnt "" then that statement becomes true hence it should not
have worked.. yet it does...
Rafe
"Aaron Bertrand - MVP" <aaron@TRASHaspfaq.com> wrote in message
news:OkqzeQfVDHA.2000@TK2MSFTNGP09.phx.gbl..."&formatcurrency(rst.fields("price"),2)&"</form>"> Maybe optiondone is NULL, which is not the same as ""?
>
>
>
> "Rafe Harwood" <rafe@harvardclose.co.uk> wrote in message
> news:EOxVa.1156$CR5.70@newsfep3-gui.server.ntli.net...> "<div> > I have a problem with an if statement which runs along the lines of ...
> >
> > do while not rst.eof
> > if optiondone<>rst.fields("description") then response.write> "<br> > class=""littleandorange""
> > style=""font-size:90%"">"&rst.fields("description")&"</div>"
> > optiondone=rst.fields("description")
> > if optiondone<>"" then response.write "" else response.write> > />"
> > response.write "<form action="""&myurl&"?"&myqs&"""
> > method=""post""><input type=""hidden"" name=""add""
> > value="""&rst.fields("itemID")&""" /><input type=""image"" id=""submit""
> > src=""/images/select.gif"" alt=""Add "&rst.fields("name")&" at
> > "&formatcurrency(rst.fields("price"),2)&" to your order"" /> -
> > "&rst.fields("name")&" -mean> ""> > rst.movenext
> > loop
> >
> > This version with the weird if optiondone<>"" then response.write> > else response.write "<br />" works fine.. to my mind that would=> > that exactly the same should work if used the other way round and using"&formatcurrency(rst.fields("price"),2)&"</form>"> "<div> > instead of <> and the basically non-existant response, looking for a
> > negative to produce the required action.
> >
> > If I try this however..
> >
> > do while not rst.eof
> > if optiondone<>rst.fields("description") then response.write> > class=""littleandorange""
> > style=""font-size:90%"">"&rst.fields("description")&"</div>"
> > optiondone=rst.fields("description")
> > if optiondone="" then response.write "<br />"
> > response.write "<form action="""&myurl&"?"&myqs&"""
> > method=""post""><input type=""hidden"" name=""add""
> > value="""&rst.fields("itemID")&""" /><input type=""image"" id=""submit""
> > src=""/images/select.gif"" alt=""Add "&rst.fields("name")&" at
> > "&formatcurrency(rst.fields("price"),2)&" to your order"" /> -
> > "&rst.fields("name")&" ->> > rst.movenext
> > loop
> >
> > then it falls over and the break is not written...
> >
> > Any ideas as to why a negative response works yet a positive fails?
> >
> > Rafe
> >
> >
>
Rafe Harwood Guest
-
A very confusing question ?
As all of the people told that assemblies are of three types, Private, Public & Satellite. But I think these are of only two types: 1. Single... -
URL.CFID confusing sessions
Where do I start? When going to any of our web sites, the home page comes up and i the URL I have a CFID and CFTOKEN URL vars. On this same home... -
Deployment of a Site Confusing!
I have tried several ways to sync up my Developement and test servers, but it is not updating my test server. I understand there are three... -
I'm confusing myself
Hiyer, I've used Flash for creating CD-Roms but Ive been asked to design a web site. I'm now getting myself really confused too. I want to add in... -
confusing error
I am getting a confusing 'object expected' error in IE when this script executes, but I can't figure out why. It stops all other scripts on my... -
Bob Barrows #2
Re: Confusing confitional statement
Comparing anything to Null returns Null, not True or False.
Far better is to check the length of optiondone:
if len(optiondone) > 0 then 3
etc.
HTH,
Bob Barrows
Rafe Harwood wrote:> ok.. so if thats the issue, then the original
>
> if optiondone<>"" then response.write "" else response.write "<br />"
>
> because if it wasnt "" then that statement becomes true hence it
> should not have worked.. yet it does...
>
> Rafe
>
>
>
> "Aaron Bertrand - MVP" <aaron@TRASHaspfaq.com> wrote in message
> news:OkqzeQfVDHA.2000@TK2MSFTNGP09.phx.gbl...>> Maybe optiondone is NULL, which is not the same as ""?
>>
>>
>>
>> "Rafe Harwood" <rafe@harvardclose.co.uk> wrote in message
>> news:EOxVa.1156$CR5.70@newsfep3-gui.server.ntli.net...>>> I have a problem with an if statement which runs along the lines of
>>> ...
>>>
>>> do while not rst.eof
>>> if optiondone<>rst.fields("description") then
>>> response.write "<div class=""littleandorange""
>>> style=""font-size:90%"">"&rst.fields("description")&"</div>"
>>> optiondone=rst.fields("description")
>>> if optiondone<>"" then response.write "" else
>>> response.write "<br />"
>>> response.write "<form action="""&myurl&"?"&myqs&"""
>>> method=""post""><input type=""hidden"" name=""add""
>>> value="""&rst.fields("itemID")&""" /><input type=""image""
>>> id=""submit"" src=""/images/select.gif"" alt=""Add
>>> "&rst.fields("name")&" at "&formatcurrency(rst.fields("price"),2)&"
>>> to your order"" /> - "&rst.fields("name")&" -
>>> "&formatcurrency(rst.fields("price"),2)&"</form>"
>>> rst.movenext loop
>>>
>>> This version with the weird if optiondone<>"" then
>>> response.write "" else response.write "<br />" works fine.. to
>>> my mind that would mean that exactly the same should work if used
>>> the other way round and using = instead of <> and the basically
>>> non-existant response, looking for a negative to produce the
>>> required action.
>>>
>>> If I try this however..
>>>
>>> do while not rst.eof
>>> if optiondone<>rst.fields("description") then
>>> response.write "<div class=""littleandorange""
>>> style=""font-size:90%"">"&rst.fields("description")&"</div>"
>>> optiondone=rst.fields("description")
>>> if optiondone="" then response.write "<br />"
>>> response.write "<form action="""&myurl&"?"&myqs&"""
>>> method=""post""><input type=""hidden"" name=""add""
>>> value="""&rst.fields("itemID")&""" /><input type=""image""
>>> id=""submit"" src=""/images/select.gif"" alt=""Add
>>> "&rst.fields("name")&" at "&formatcurrency(rst.fields("price"),2)&"
>>> to your order"" /> - "&rst.fields("name")&" -
>>> "&formatcurrency(rst.fields("price"),2)&"</form>"
>>> rst.movenext loop
>>>
>>> then it falls over and the break is not written...
>>>
>>> Any ideas as to why a negative response works yet a positive fails?
>>>
>>> Rafe
Bob Barrows Guest
-
Bob Barrows #3
Re: Confusing confitional statement
Ray at <%=sLocation%> wrote:
I SAID not to ask me that ... ;-)> What's 3?
>
Bob Barrows Guest
-
Rafe Harwood #4
Re: Confusing conditional statement
> >> "Rafe Harwood" <rafe@harvardclose.co.uk> wrote in message
> >> news:EOxVa.1156$CR5.70@newsfep3-gui.server.ntli.net...
> >>> I have a problem with an if statement which runs along the lines of
> >>> ...
> >>>
> >>> do while not rst.eof
> >>> if optiondone<>rst.fields("description") then
> >>> response.write "<div class=""littleandorange""
> >>> style=""font-size:90%"">"&rst.fields("description")&"</div>"
> >>> optiondone=rst.fields("description")
> >>> if optiondone<>"" then response.write "" else
> >>> response.write "<br />"
> >>> response.write "<form action="""&myurl&"?"&myqs&"""
> >>> method=""post""><input type=""hidden"" name=""add""
> >>> value="""&rst.fields("itemID")&""" /><input type=""image""
> >>> id=""submit"" src=""/images/select.gif"" alt=""Add
> >>> "&rst.fields("name")&" at "&formatcurrency(rst.fields("price"),2)&"
> >>> to your order"" /> - "&rst.fields("name")&" -
> >>> "&formatcurrency(rst.fields("price"),2)&"</form>"
> >>> rst.movenext loop
> >>>
> >>> This version with the weird if optiondone<>"" then
> >>> response.write "" else response.write "<br />" works fine.. to
> >>> my mind that would mean that exactly the same should work if used
> >>> the other way round and using = instead of <> and the basically
> >>> non-existant response, looking for a negative to produce the
> >>> required action.
> >>>
> >>> If I try this however..
> >>>
> >>> do while not rst.eof
> >>> if optiondone<>rst.fields("description") then
> >>> response.write "<div class=""littleandorange""
> >>> style=""font-size:90%"">"&rst.fields("description")&"</div>"
> >>> optiondone=rst.fields("description")
> >>> if optiondone="" then response.write "<br />"
> >>> response.write "<form action="""&myurl&"?"&myqs&"""
> >>> method=""post""><input type=""hidden"" name=""add""
> >>> value="""&rst.fields("itemID")&""" /><input type=""image""
> >>> id=""submit"" src=""/images/select.gif"" alt=""Add
> >>> "&rst.fields("name")&" at "&formatcurrency(rst.fields("price"),2)&"
> >>> to your order"" /> - "&rst.fields("name")&" -
> >>> "&formatcurrency(rst.fields("price"),2)&"</form>"
> >>> rst.movenext loop
> >>>
> >>> then it falls over and the break is not written...
> >>>
> >>> Any ideas as to why a negative response works yet a positive fails?
> >>>
> >>> Rafe> > "Aaron Bertrand - MVP" <aaron@TRASHaspfaq.com> wrote in message
> > news:OkqzeQfVDHA.2000@TK2MSFTNGP09.phx.gbl...> >> Maybe optiondone is NULL, which is not the same as ""?> Rafe Harwood wrote:> > ok.. so if thats the issue, then the original
> >
> > if optiondone<>"" then response.write "" else response.write "<br />"
> >
> > because if it wasnt "" then that statement becomes true hence it
> > should not have worked.. yet it does...
> >
> > Rafe
"Bob Barrows" <reb_01501@yahoo.com> wrote in message
news:uoVkVifVDHA.2040@TK2MSFTNGP10.phx.gbl...ok.. after a little editing of the order of posts... and correcting the> Comparing anything to Null returns Null, not True or False.
>
> Far better is to check the length of optiondone:
>
> if len(optiondone) > 0 then 3
> etc.
>
> HTH,
> Bob Barrows
typo in the thread hehe
Thanks Bob,
That works for the negative response as if the size is over 0 then I do not
want the break included, but it falls over when testing for a size <1 which
would be the time to display the break.. hence
if len(optiondone)<1 then write "<br />"
which I suppose is the same thing as the null issue but not sure
anyway, that statement also falls over...
the way I just solved it was to check for a null value
if isnull(optiondone) then write "<br />"
still doesnt answer my question about the difference in checking which was
my major bugbear.. but it solves the issue perfectly :O)
thank you for the heads up Aaron :O)
I didnt realise that setting the value of optiondone to "" in fact created a
null and not "" which is obviously what happens, as optiondone is populated
earlier in the results, but on checking for the null after setting it to ""
the response comes back as true and the break displayed
Rafe
Rafe Harwood Guest
-
Bob Barrows #5
Re: Confusing conditional statement
Rafe Harwood wrote:
You don't need this. Why are you doing this? A simple> Thanks Bob,
> That works for the negative response as if the size is over 0 then I
> do not want the break included, but it falls over when testing for a
> size <1 which would be the time to display the break.. hence
>
> if len(optiondone)<1 then write "<br />"
if len(optiondone)>0 then
'do the stuff you need to do when optiondone contains a value
else
response.write "<br />"
end if
will suffice.
It doesn't. "" is an empty string. It is NOT Null. Try this:>
> which I suppose is the same thing as the null issue but not sure
>
>
> anyway, that statement also falls over...
>
> the way I just solved it was to check for a null value
>
> if isnull(optiondone) then write "<br />"
>
> still doesnt answer my question about the difference in checking
> which was my major bugbear.. but it solves the issue perfectly :O)
> thank you for the heads up Aaron :O)
>
> I didnt realise that setting the value of optiondone to "" in fact
> created a null and not ""
optiondone = ""
if isnull(optiondone) then
response.write "optiondone contains Null"
else
response.write "opriondone contains an empty string"
end if
Are you sure??? Your code is written in a very confusing manner (in fact, I> which is obviously what happens, as
> optiondone is populated earlier in the results, but on checking for
> the null after setting it to "" the response comes back as true and
> the break displayed
>
skipped your post the first time since I did not feel like digging into
it) - no formatting or white-space to improve its readability. I suppose it
could be your newsreader doing this... I suspect you may be missing
something, but again, I don't feel like digging into your code. Sorry.
Bob Barrows
Bob Barrows Guest
-
Rafe Harwood #6
Re: Confusing conditional statement
"Bob Barrows" <reb_01501@yahoo.com> wrote in message
news:#3iP8TgVDHA.3332@tk2msftngp13.phx.gbl...I> Rafe Harwood wrote:>> > Thanks Bob,
> > That works for the negative response as if the size is over 0 then I
> > do not want the break included, but it falls over when testing for a
> > size <1 which would be the time to display the break.. hence
> >
> > if len(optiondone)<1 then write "<br />"
> You don't need this. Why are you doing this? A simple
>
> if len(optiondone)>0 then
> 'do the stuff you need to do when optiondone contains a value
> else
> response.write "<br />"
> end if
>
> will suffice.
>>> >
> > which I suppose is the same thing as the null issue but not sure
> >
> >
> > anyway, that statement also falls over...
> >
> > the way I just solved it was to check for a null value
> >
> > if isnull(optiondone) then write "<br />"
> >
> > still doesnt answer my question about the difference in checking
> > which was my major bugbear.. but it solves the issue perfectly :O)
> > thank you for the heads up Aaron :O)
> >
> > I didnt realise that setting the value of optiondone to "" in fact
> > created a null and not ""
> It doesn't. "" is an empty string. It is NOT Null. Try this:
>
> optiondone = ""
> if isnull(optiondone) then
> response.write "optiondone contains Null"
> else
> response.write "opriondone contains an empty string"
> end if
>> Are you sure??? Your code is written in a very confusing manner (in fact,> > which is obviously what happens, as
> > optiondone is populated earlier in the results, but on checking for
> > the null after setting it to "" the response comes back as true and
> > the break displayed
> >it> skipped your post the first time since I did not feel like digging into
> it) - no formatting or white-space to improve its readability. I supposeOoops.. please excuse the mistake..> could be your newsreader doing this... I suspect you may be missing
> something, but again, I don't feel like digging into your code. Sorry.
>
> Bob Barrows
the center of the code goes
optiondone=rst.fields("description")
if isnull(optiondone) then write "<br />"
so it is in fact getting a null from the database
Hmmm.. a cup of tea might be in order here
And yes I am using Outlook Express.. and to the people in here who have a
problem with it, Im really not to bothered.. helping and getting help
matters not what tools are used to achieve that :O)
Rafe
Rafe Harwood Guest



Reply With Quote

