IF statements gone bad

IF statements gone bad

am 27.06.2007 17:17:20 von oldmankirby

I have a problem I really can't figure out what I am doing wrong. I
have the following code:


stnum = "0"
inull = "SAM1"
aname = "a"
bname="a"

while Not rs.EOF

if (stnum <> rs("sn") and aname <> rs("fname") and bname <>
rs("lname") and inull = rs("idModule")) then
response.write ("Store #   td>   ")
response.write ("" & rs("sn") & " td>    ")
response.write (" Employee ID  td>NamePositionHire Date")
response.write (" " &
rs("empid") & "
" & rs("idModule") & "" &
rs("fname") & " " & rs("lname") & "" & rs("description") & " td>" & rs("hiredate") & " ")


elseif (stnum <> rs("sn") and aname <> rs("fname") and bname <>
rs("lname") and inull <> rs("idModule")) then
response.write ("Store #   td>   ")
response.write ("" & rs("sn") & " td>    ")
response.write (" Employee ID  td>NamePositionHire Date")
response.write (" " &
rs("empid") & "
" & rs("idModule") & "" &
rs("fname") & " " & rs("lname") & "" & rs("description") & " td>" & rs("hiredate") & " ")


else
response.write("   tr>")
response.write("" & rs("sn") & "  td> " & rs("fname") & " " & rs("lname") & " td> " & rs("empid") & " " &
rs("Description") & " " & rs("HireDate") & " td>")
end if

stnum = rs("sn")
aname = rs("fname")
bname = rs("lname")

rs.MoveNext

Wend




Here a sample of what the outout looks like:

Store #
2
Employee ID Name
Position Hire Date
9999999 SAM1 Sean
Analyst 6/4/2007

Sean
3 33333333 SAM3 Bob
test 6/1/2007

All the data is coming from a MS SQL DB. So here is my issue if SAM1
= idmodule then emp id is supposed to be blue if iit does not then
the employee id should be red. No matter what, the empid is red.
Where am I going wrong?

Re: IF statements gone bad

am 30.06.2007 18:33:53 von Jon Paal

It's likely the combination of variables in the SQL test never satisfy the expected outcome.





wrote in message news:1182957440.939704.7270@m36g2000hse.googlegroups.com...
>I have a problem I really can't figure out what I am doing wrong. I
> have the following code:
>
>
> stnum = "0"
> inull = "SAM1"
> aname = "a"
> bname="a"
>
> while Not rs.EOF
>
if (stnum <> rs("sn") and aname <> rs("fname") and bname <> rs("lname") and inull = rs("idModule")) then
...
elseif (stnum <> rs("sn") and aname <> rs("fname") and bname <> rs("lname") and inull <> rs("idModule")) then
...
else
....
end if
>
....

> All the data is coming from a MS SQL DB. So here is my issue if SAM1
> = idmodule then emp id is supposed to be blue if iit does not then
> the employee id should be red. No matter what, the empid is red.
> Where am I going wrong?
>