M
mike
I've got some code like this:
gametype_id = Request.Form("gametype_id")
response.write "<br>gametype_id from form>" & gametype_id & "<"
response.write "<br>gametype_id from database>" &
rs_state("gametype_id") & "<"
if gametype_id = "" then
gametype_id = rs_state("gametype_id") 'could be NULL and make
gametype_id NULL
else
'the gametype from the form is not empty or NULL, so consider
updating the database record
'strComp returns -1 if the first value is smaller, a 0 if they're
equal, a 1 if the second value is smaller, or Null if either input is
Null.
'if strComp(gametype_id, rs_state("gametype_id"), vbTextCompare) <>
0 then
'nothing
if gametype_id <> rs_state("gametype_id") then
response.write "<br>updating gametype_id"
sql = "update maxminisuser set gametype_id = " & gametype_id & "
where userid =" & userid
conn.execute sql, , 129
end if
end if
ok now when I run the page I get this:
gametype_id from form>1<
gametype_id from database>1<
updating gametype_id <------WHY is this happening??
if I have two strings both equaling "1" as printed out above then why
does the line:
if gametype_id <> rs_state("gametype_id") then...
evaluate as true?????
<> is not equal to, as far as I know this works on strings??
when I use if strComp then it performs as expected, however <> is more
logical and readable and I want to understand why it is happening.
On the same page I have this statement:
if "1" = "1" then response.write "<br>1=1"
and it writes 1=1
when I do this
if "1" <> "1" then
response.write "1<>1"
end if
then it doesnt write anything
?????
so whats the difference between that line and
if gametype_id <> rs_state("gametype_id")
when both expressions printed out as "1" just before its evaluated??
soooo confused. What am I missing here???
-Mike
gametype_id = Request.Form("gametype_id")
response.write "<br>gametype_id from form>" & gametype_id & "<"
response.write "<br>gametype_id from database>" &
rs_state("gametype_id") & "<"
if gametype_id = "" then
gametype_id = rs_state("gametype_id") 'could be NULL and make
gametype_id NULL
else
'the gametype from the form is not empty or NULL, so consider
updating the database record
'strComp returns -1 if the first value is smaller, a 0 if they're
equal, a 1 if the second value is smaller, or Null if either input is
Null.
'if strComp(gametype_id, rs_state("gametype_id"), vbTextCompare) <>
0 then
'nothing
if gametype_id <> rs_state("gametype_id") then
response.write "<br>updating gametype_id"
sql = "update maxminisuser set gametype_id = " & gametype_id & "
where userid =" & userid
conn.execute sql, , 129
end if
end if
ok now when I run the page I get this:
gametype_id from form>1<
gametype_id from database>1<
updating gametype_id <------WHY is this happening??
if I have two strings both equaling "1" as printed out above then why
does the line:
if gametype_id <> rs_state("gametype_id") then...
evaluate as true?????
<> is not equal to, as far as I know this works on strings??
when I use if strComp then it performs as expected, however <> is more
logical and readable and I want to understand why it is happening.
On the same page I have this statement:
if "1" = "1" then response.write "<br>1=1"
and it writes 1=1
when I do this
if "1" <> "1" then
response.write "1<>1"
end if
then it doesnt write anything
?????
so whats the difference between that line and
if gametype_id <> rs_state("gametype_id")
when both expressions printed out as "1" just before its evaluated??
soooo confused. What am I missing here???
-Mike