Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 is there any kind of Boolean type SQL server

Author  Topic 

rtutus
Aged Yak Warrior

522 Posts

Posted - 2006-01-19 : 20:43:08
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
Master Smack Fu Yak Hacker

1378 Posts

Posted - 2006-01-19 : 20:53:26
vbUnchecked --> 0
VbChecked --> 1
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

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


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

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-01-20 : 01:48:00
bit can also be NULL

Madhivanan

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

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-01-20 : 01:57:39
>> 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 - 2006-01-20 : 08:35:11
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

3608 Posts

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

Kristen
Test

22859 Posts

Posted - 2006-01-20 : 10:36:43
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

3608 Posts

Posted - 2006-01-20 : 10:41:00
Or just make the field non-nullable.
Go to Top of Page

rtutus
Aged Yak Warrior

522 Posts

Posted - 2006-01-21 : 19:04:30
I ll do that, that works perfectly. thanks a lot.
Go to Top of Page
   

- Advertisement -