Author |
Topic |
|
Alfred
Senior Member
USA
1527 Posts |
Posted - 24 September 2003 : 12:43:49
|
How do I include number fields that contain no value in the following "if" statement quote: if intChallengerSpot(0) = 0 then strSql = "UPDATE FORUM_MEMBERS SET LADDER_SPOT = " & intHighSpot(0) & "+1 WHERE M_NAME = '" & request.form("CHALLENGER") & "'" my_Conn.execute(strSql) end if
how must I specify the empty field? I tried if intChallengerSpot(0) = null, but that did not work. |
Alfred The Battle Group CREDO
|
|
Shaggy
Support Moderator
Ireland
6780 Posts |
Posted - 24 September 2003 : 12:49:39
|
Try:If len(intChallengerSpot(0)) or intChallengerSpot(0) = 0 then
...
end if Or, better:If cInt(intChallengerSpot(0)) then
...
end if |
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
|
|
Alfred
Senior Member
USA
1527 Posts |
Posted - 24 September 2003 : 13:08:48
|
quote: Originally posted by MeTV
Try:If len(intChallengerSpot(0)) or intChallengerSpot(0) = 0 then
...
end if Or, better:If cInt(intChallengerSpot(0)) then
...
end if
I got an error on that: quote: Error Type: Microsoft VBScript runtime (0x800A005E) Invalid use of Null: 'cInt' /BG/forums/Admin_Games_AddGame_handler.asp,
What I need is the equivalent of the text field code: quote: if intChallengerSpot("M_name") = '' then ...
but modified for a number field. |
Alfred The Battle Group CREDO
|
Edited by - Alfred on 24 September 2003 22:13:35 |
|
|
Nikkol
Forum Moderator
USA
6907 Posts |
|
Alfred
Senior Member
USA
1527 Posts |
Posted - 24 September 2003 : 23:10:54
|
quote: Originally posted by NikkolTry using if IsNull(intChallengerSpot(0)) then
That was the magic formula I was looking for! Thanks Nikkol, this did it. |
Alfred The Battle Group CREDO
|
|
|
Shaggy
Support Moderator
Ireland
6780 Posts |
Posted - 25 September 2003 : 04:51:41
|
Apologies, Alfred, I was using cInt on a few variables on my site which could have be null and it returned 0. On closer inspection, though the functions that assign values to those variables actually return 0 instead of null.
|
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
|
|
Alfred
Senior Member
USA
1527 Posts |
Posted - 25 September 2003 : 20:07:21
|
No problem, thanks for trying to help, anyway! |
Alfred The Battle Group CREDO
|
|
|
Bassman
Junior Member
Netherlands
256 Posts |
Posted - 03 October 2003 : 07:22:27
|
Thanks was just in the need of this little code trick... |
|
|
|
Topic |
|