Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP 3.0 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 June 24th, 2005, 09:35 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 100
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to ~Bean~
Default Checking for Null

How do I check for a null value in a boolean field in my DB?

I keep getting a type mismatch error when trying to check the field for a value and I know it has a null value in the DB...

???


-------------------------
Beware of programmers with screwdrivers...
__________________
-------------------------
Beware of programmers with screwdrivers...
 
Old June 24th, 2005, 08:14 PM
Friend of Wrox
Points: 793, Level: 10
Points: 793, Level: 10 Points: 793, Level: 10 Points: 793, Level: 10
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2005
Location: OKC, OK, USA.
Posts: 227
Thanks: 1
Thanked 7 Times in 7 Posts
Default

You would get the mismatch error because a Boolean field is always a bit-field, meaning the bit is either on or off, '1'B or '0'B, in basic it is either '-1'B or '0'B, but never null. However you can set the bit, as a default value.

Hope this helps.

peace95
 
Old June 27th, 2005, 07:09 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 100
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to ~Bean~
Default

Thanks. The table I am working with has about 2000 records and whoever set it up in the beginning allowed null values in the boolean fields. Now most of the bools are filled with null, as well as a few date fields and others too.

I guess I can use a simple function to check for true/false and return false if there's an (type mismatch) error, but I guess I was hoping there was something like IsNull() for bools in ASP...

-------------------------
Beware of programmers with screwdrivers...




Similar Threads
Thread Thread Starter Forum Replies Last Post
Error checking for table fields null value constra method Access VBA 1 September 26th, 2005 09:00 PM
How to set Not Null constraint to Null Columns arasu Oracle 1 August 22nd, 2005 10:09 AM
Checking for Null Values asmodeus BOOK: Beginning VB.NET Databases 2 June 3rd, 2005 03:18 PM
Checking null values in Query(SQL Server) Prob leo_vinay Classic ASP Databases 2 December 28th, 2004 04:31 AM
checking for duplicates jammykam Access 3 October 2nd, 2003 08:06 PM





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