Wrox Programmer Forums
|
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 September 9th, 2004, 11:47 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 119
Thanks: 0
Thanked 0 Times in 0 Posts
Default Difference between null and empty string

Please explain with an example the difference between null
and empty string. ALso the difference between '1' and "1".

 
Old September 9th, 2004, 04:23 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Null is an absence of a value. An empty string is a value, but is just empty. Null is special to a database. The difference between '1' and "1" for in a database query is that the SQL syntax supports '1' for SQL queries, but doesn't use "1".

Brian
 
Old September 9th, 2004, 05:35 PM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 119
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Can any body give me an example when to use null and empty string.
I dont understand at what situation we can use them. Actually
it doesnot make me sense. I hope someone give will give me example
and explain the answer. Thanks.
shoakat

 
Old September 9th, 2004, 08:56 PM
Authorized User
 
Join Date: Aug 2004
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

well, IMO, NULL isn't allocated any memory, the string with NUll value is just a pointer which is pointing to nowhere in memory. however, Empty IS allocated to a memory location, although the value stored in the memory is "".
it is up to you when to use empty or null if the field type is char.
save memory, shouldn't?

 
Old September 10th, 2004, 11:40 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Null has no bounds, it can be used for string, integer, date, etc. fields in a database. Empty string is just regarding a string; it's a string like 'asdfasdf' is, but is just has no length. If you have no value for a field, use null, not an empty string.

Null is the database's determination of an absense of a value logically, so to speak. You can query like: where FIELD_NAME is NULL

Brian





Similar Threads
Thread Thread Starter Forum Replies Last Post
empty string Vince_421 VB Databases Basics 2 October 29th, 2008 03:24 PM
Is String.Empty spinout ASP.NET 2.0 Basics 6 July 10th, 2007 05:55 AM
0, Empty Strings and Null Loralee Access 8 August 10th, 2005 10:13 PM
Don;t diplay text box if it is empty or null abdul_wasie Classic ASP Databases 5 May 20th, 2005 11:49 PM
search for null /String.Empty in Active Directory georgeh C# 1 October 16th, 2003 08:09 AM





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