Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Databases
Password Reminder
Register
Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 9th, 2004, 11:47 AM
Friend of Wrox
 
Join Date: Jul 2004
Location: , , .
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".

Reply With Quote
  #2 (permalink)  
Old September 9th, 2004, 04:23 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
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
Reply With Quote
  #3 (permalink)  
Old September 9th, 2004, 05:35 PM
Friend of Wrox
 
Join Date: Jul 2004
Location: , , .
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

Reply With Quote
  #4 (permalink)  
Old September 9th, 2004, 08:56 PM
Authorized User
 
Join Date: Aug 2004
Location: , , Singapore.
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?

Reply With Quote
  #5 (permalink)  
Old September 10th, 2004, 11:40 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 10:19 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.