SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 is there any kind of Boolean type SQL server
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

rtutus
Aged Yak Warrior

522 Posts

Posted - 01/19/2006 :  20:43:08  Show Profile  Reply with Quote
Hi,
I have a boolean check property of my check boxes in VB.NET. how can I send that value to SQL server, is there a boolean type in SQL server when I m designing the table.

Thanks

Srinika
Flowing Fount of Yak Knowledge

Sri Lanka
1378 Posts

Posted - 01/19/2006 :  20:53:26  Show Profile  Reply with Quote
vbUnchecked --> 0
VbChecked --> 1
Go to Top of Page

khtan
In (Som, Ni, Yak)

Singapore
17601 Posts

Posted - 01/19/2006 :  20:55:49  Show Profile  Reply with Quote
bit
Integer data with either a 1 or 0 value.


-----------------
'KH'

Go to Top of Page

madhivanan
Premature Yak Congratulator

India
22754 Posts

Posted - 01/20/2006 :  01:48:00  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
bit can also be NULL

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

khtan
In (Som, Ni, Yak)

Singapore
17601 Posts

Posted - 01/20/2006 :  01:57:39  Show Profile  Reply with Quote
>> bit can also be NULL
You are right.

Then create the column as not null

-----------------
'KH'

Go to Top of Page

rtutus
Aged Yak Warrior

522 Posts

Posted - 01/20/2006 :  08:35:11  Show Profile  Reply with Quote
Thanks guys. I guess there is no other alternative but doing the test and assigning either 0 or 1 values instead of just boolean type of VB checkbox.checked property.
If checkbox1.checked=true then i=0 else i=1

thanks
Go to Top of Page

RickD
Slow But Sure Yak Herding Master

United Kingdom
3608 Posts

Posted - 01/20/2006 :  08:59:13  Show Profile  Reply with Quote
AFAIK, VB use's 3 states as well..
Go to Top of Page

Kristen
Test

United Kingdom
22403 Posts

Posted - 01/20/2006 :  10:36:43  Show Profile  Reply with Quote
I expect passing a native datatype of True/False to SQL Server will arrive at the SQL end as 1 or 0 - but I don't have VB here to check.

Otherwise you'll need the IF ... THEN ... ELSE as you suggested, or a VB Function to "wrap" the task with - e.g. if you have several to do.

Kristen
Go to Top of Page

RickD
Slow But Sure Yak Herding Master

United Kingdom
3608 Posts

Posted - 01/20/2006 :  10:41:00  Show Profile  Reply with Quote
Or just make the field non-nullable.
Go to Top of Page

rtutus
Aged Yak Warrior

522 Posts

Posted - 01/21/2006 :  19:04:30  Show Profile  Reply with Quote
I ll do that, that works perfectly. thanks a lot.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.12 seconds. Powered By: Snitz Forums 2000