Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 how do I specify emty fields in a record?
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Alfred
Senior Member

USA
1527 Posts

Posted - 24 September 2003 :  12:43:49  Show Profile  Visit Alfred's Homepage
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  Show Profile
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.”
Go to Top of Page

Alfred
Senior Member

USA
1527 Posts

Posted - 24 September 2003 :  13:08:48  Show Profile  Visit Alfred's Homepage
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
Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 24 September 2003 :  22:20:31  Show Profile
The invalid use of Null error means that the value is null ...

Try using
if IsNull(intChallengerSpot(0)) then

Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~
Go to Top of Page

Alfred
Senior Member

USA
1527 Posts

Posted - 24 September 2003 :  23:10:54  Show Profile  Visit Alfred's Homepage
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
Go to Top of Page

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 25 September 2003 :  04:51:41  Show Profile
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.”
Go to Top of Page

Alfred
Senior Member

USA
1527 Posts

Posted - 25 September 2003 :  20:07:21  Show Profile  Visit Alfred's Homepage
No problem, thanks for trying to help, anyway!

Alfred
The Battle Group
CREDO
Go to Top of Page

Bassman
Junior Member

Netherlands
256 Posts

Posted - 03 October 2003 :  07:22:27  Show Profile  Visit Bassman's Homepage
Thanks was just in the need of this little code trick...
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.34 seconds. Powered By: Snitz Forums 2000 Version 3.4.07