Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

checking a null value

Status
Not open for further replies.

snowneil

Programmer
Mar 22, 2006
40
GB
I have got a SELECT statement that returns a recordset, with one of its values being 'acId'.

acId is either null or an id number.

Eg. In the Microsoft sql server database table the value in the acId field for each record is either <NULL> or an id number acting as a foreign key.

The below if statement returns false when it should be returning true.
Code:
var acId = sqlRS('acId');
if(isNaN(acId))
{
 <code>
}
else
{
 <code>
}

I have also tried doing the below after declaring the variable.
Code:
String(acId);
if(acId == "")

and without the String function i tried:
if(acId == null || acId == "" || acId == "null")

All of these if statements keep returning false when the acId is null which is wrong.

Could anyone shed some light on this situation for me please.
 
asp javascript.. sorry forgot to mention that.
 
Code:
acId[COLOR=red].value[/color] == null

------------------------------------------------------------------------------------------------------------------------
"Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."
- Winston Churchill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top