Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 27th, 2004, 03:57 PM
Friend of Wrox
 
Join Date: Jul 2004
Location: , , .
Posts: 119
Thanks: 0
Thanked 0 Times in 0 Posts
Default when to use is Null and =null and"null

if (iEmpID ==""){
    objParam1.value=null;
 if dateFrom = "" then
    strUpdate = strUpdate + " and dtRateFrom is null"

  if resType="E" then
    strEmpID = cstr(iEmpID)
    strSubID = "null"
Please let me know what is the difference between is null and =null and "null" As shown above why I am using three different cases of null
in the above three codes. Please help me. I will appreciate your suggestions and comments. Thanks

 
Old October 27th, 2004, 08:05 PM
Friend of Wrox
 
Join Date: Sep 2003
Location: Mentiri, Muara, Brunei.
Posts: 363
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi,

  var n1,n2=null,n3=="null";

  n1 is declared but not initialised so it is equivallent to null.
n2 is assigned null.
n3 is string variable contains value "null". Its not eq to null.

if(n1==null){
    alert("n1 is null");
}
if(n2==null){
    alert("n2 is null");
}
if(n3=="null"){
    alert("n3 is \"null\");
}



------------
Rajani

 
Old October 28th, 2004, 07:39 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Use is null when checking the status of a field in sql:

select * from table where field1 is null

Use = null when assigning

update table set field1 = null

"null" is a string value that says null.

Brian
 
Old October 29th, 2004, 01:47 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Shoakat,

Did you do a search on this here, you would find a handfull of such threads discussed on that NULL subject that should be useful to you.

Cheers!

_________________________
- Vijay G
Strive for Perfection




Similar Threads
Thread Thread Starter Forum Replies Last Post
Null Value Yasho VB.NET 2002/2003 Basics 1 June 21st, 2007 04:37 AM
Null Ignored... Why? SerranoG Access VBA 13 December 28th, 2005 12:41 PM
How to set Not Null constraint to Null Columns arasu Oracle 1 August 22nd, 2005 10:09 AM
Is A Null Different from Another Null ramk_1978 SQL Language 9 February 12th, 2005 03:18 PM
Not Null morpheus SQL Server 2000 12 November 20th, 2003 05:46 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.