Wrox Programmer Forums
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 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 August 19th, 2004, 10:29 AM
Registered User
 
Join Date: Aug 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default SQL Boolean thing

Hi,
I have a webpage accessing a sql database where it checks whether a user is currently logged in(its a sql boolean type).

when users are created its null(lord knows why those DBA's wont default it),anyway,the first time its NULL ,and when I do a select on it ,it threw an error(cause iwas trying to cast it to VB.NET boolean);

however,the next time I select it ,it works!!Its one of those What-The-Hell type things?

Maybe someone knows more,if so,please tell me about it.


regards,
KB

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

Hey,

When you access it, do you use:

if (not objRow.IsNull("boolean")) then

end if

I would recommend that when accessing a nullable field. You can't add a default value of 0 or 1 to the table column?

Brian
 
Old August 19th, 2004, 02:41 PM
Registered User
 
Join Date: Aug 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am going to do that from now on.just that it doesnt seem right that sql wouldn't do it the first time,but works the second time(both time only SELECT)


 
Old August 20th, 2004, 07:36 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Was it the same exact query? That shouldn't be right? Did anything change, even minute?
 
Old August 20th, 2004, 10:16 AM
Registered User
 
Join Date: Aug 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It was the same query;nothing changed;except maybe a minute's delay in navigatin back to login page and re-try.
now i have that null check in place.
Is this thing bound to happen with a dataset also? if so how to check whether tables exist inside the ds?


 
Old August 20th, 2004, 01:31 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

Well, no, whether rows are returned or aren't, the dataset will have one table. The table just will have rows or won't have rows.

Brian





Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL "WHERE" Statement Boolean filtering Nostromo77 ASP.NET 2.0 Basics 2 May 27th, 2008 11:09 AM
About CSS Chapter 5 the <thing> + <thing> {} part thenetduck BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 0 February 7th, 2007 03:45 AM
Very important thing Kodak Javascript 6 September 10th, 2005 10:58 PM





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