Re: ASP "IF" Problem

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Ed Richter (erichter1_at_frontiernet.net)
Date: 03/05/05


Date: Sat, 05 Mar 2005 03:38:43 GMT

I do have a response.write Post_comment line and the result is empty Also
as a test I changed my is statement to read:
 IF Post_1st_Ref_value <> ref_ID_num_value THEN (replaced = with <>) When
I did that, it did write the word "posted so again all indication are my IF
statement is not executing correctly, but why?

"Kevin Spencer" <kevin@DIESPAMMERSDIEtakempis.com> wrote in message
news:%23rgXwwLIFHA.2700@TK2MSFTNGP09.phx.gbl...
> Hi Ed,
>
> Thanks for the clarification. I can see why you're scratching your head. I
> have one question: How do you know that the line
>
> Post_Comment = "Posted"
>
> isn't executing? That line just assigns a value to a variable. It doesn't
> show any output. Have you tried doing
>
> Response.Write(Post_Comment)
>
> --
> HTH,
>
> Kevin Spencer
> Microsoft MVP
> .Net Developer
> What You Seek Is What You Get.
>
> "Ed Richter" <erichter1@frontiernet.net> wrote in message
> news:jHQVd.371$P15.296@news01.roc.ny...
>> What I meant was, I added some, for example; response.write
>> Post_1st_Ref_value & ref_ID_value to make sure I really was returning a
>> value, to make sure the variable wasn't empty. That gave me the expected
>> results, so knew I did have values to compare in IF statement.
>>
>> When I stated IsNum, I meant IsNumeric and again tested both variables I
>> was thinking maybe I was trying to use two variables where both were
>> numbers, but maybe one was a string and one a number so would then be
>> trying to compare a number to a string.
>>
>> What I meant by "Work correctly is, I know in this case both
>> Post_1st_Ref_value and ref_ID_value have the same value, 56 so my IF
>> statement should be true. They won't always be true, but in this case,
>> it is, therefore if they are the same, it then should execute the line
>> Post_Comment = "Posted", but it's not, therefore I'm assuming the reaason
>> it's not is because it doesn't think bot hvariables are the same. Again
>> the response.write statements are showing them to be the same.
>>
>>
>> "Kevin Spencer" <kevin@DIESPAMMERSDIEtakempis.com> wrote in message
>> news:OhyaBIBIFHA.2700@TK2MSFTNGP09.phx.gbl...
>>> Hi Ed,
>>>
>>> Your question is a bit confusing.
>>>
>>> You mention:
>>>
>>>> IF Post_1st_Ref_value = ref_ID_num_value THEN
>>>>
>>>> Post_Comment = "Posted"
>>>
>>> but then you state:
>>>
>>>> I did a bunch of testing with adding response.write statements to
>>>> verify
>>>> that the program is returning the correct data and it seems to be fine.
>>>> All
>>>> of the variables listed return the expected answer. I did an "IF
>>>> IsNum"
>>>> test
>>>> to make sure the results are numeric, again results came back OK
>>>
>>> This is not clear at all. First, a Response.Write statement isn't going
>>> to tell you anything about the data types. Response.Write always writes
>>> a string. Second, you make a general statment that you "did an "IF
>>> IsNum" test to make sure the "results" are numeric. Which "results" are
>>> you referring to? What is "IsNum"? There is an InNumeric function in
>>> VBScript, but I've never heard of an "IsNum" function. And what did you
>>> test with it? Did you test Post_1st_Ref_value? Did you test
>>> ref_ID_num_value?
>>>
>>> Finally, you state:
>>>
>>>> But no matter what I do, I can't seem to get the second IF statement to
>>>> work
>>>> correctly.
>>>
>>> Define "work correctly." What is the nature of the misbehavior?
>>>
>>> --
>>> HTH,
>>>
>>> Kevin Spencer
>>> Microsoft MVP
>>> .Net Developer
>>> Neither a follower nor a lender be.
>>>
>>> "Ed Richter" <599733@corpmail.kodak.com> wrote in message
>>> news:d07edp$ta$1@news.kodak.com...
>>>> I'm having problems getting an If statement to execute properly. Seems
>>>> I've
>>>> had similar problems in the past whenever my if statements involve
>>>> number
>>>> fields. For text, they work fine.
>>>>
>>>> I have one statement where the statement is:
>>>>
>>>> IF ref_L_name_value = First_L_name_value THEN
>>>>
>>>> This works fine and returns the desired results. But then another
>>>> statement
>>>> I have as follows:
>>>>
>>>> IF Post_1st_Ref_value = ref_ID_num_value THEN
>>>>
>>>> Post_Comment = "Posted"
>>>>
>>>>
>>>> END IF
>>>>
>>>>
>>>> I don't get the desired results.
>>>>
>>>> I did a bunch of testing with adding response.write statements to
>>>> verify
>>>> that the program is returning the correct data and it seems to be fine.
>>>> All
>>>> of the variables listed return the expected answer. I did an "IF
>>>> IsNum"
>>>> test
>>>> to make sure the results are numeric, again results came back OK
>>>>
>>>>
>>>> But no matter what I do, I can't seem to get the second IF statement to
>>>> work
>>>> correctly. Seems I've experienced similar problems in the past always
>>>> when
>>>> my IF statement contains numerical values.
>>>>
>>>>
>>>>
>>>> Any suggestions as to why it's not working or tricks to do when dealing
>>>> with
>>>> numerical data?
>>>>
>>>>
>>>>
>>>> Thanks
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>



Relevant Pages

  • Re: Simple Perl
    ... you are using the numerical comparison operator to compare ... the string 'EMPTY' is not the same as an empty string. ... The string 'EMPTY' has five characters. ...
    (comp.lang.perl.misc)
  • Re: Weird Query
    ... doesn't compare with any "real" value too, but it's not the point, the point is, that you should write your sql *according* the rules which are adopted in the rdbms engine. ... "Not empty" here being defined as ... and how it is handled by Oracle. ... an empty string. ...
    (comp.databases.oracle.misc)
  • Re: ASP "IF" Problem
    ... >> isn't executing? ... so knew I did have values to compare in IF statement. ... >>> number so would then be trying to compare a number to a string. ... that the program is returning the correct data and it seems to be fine. ...
    (microsoft.public.frontpage.client)
  • Re: empty - not empty()
    ... I pass the string "empty" to the function as a patient number if we are ... the regular compare is true with the numeric value of zero. ...
    (comp.lang.php)
  • Re: empty - not empty()
    ... I pass the string "empty" to the function as a patient number ... conversion done. ... "If you compare a number with a string or the comparison involves ...
    (comp.lang.php)