i am using asp.net application to enter and view data in sql server database.
i am not sure what data type to use in sql server to allow booleans?
when entering data into the database the users will be clicking on a check box to signify true/false.
- how do i implement bools with sql server?
- how do i give the ability to th开发者_开发问答e user in formview to enter true/false?
As the others said, you can use BIT
datatype.
However, be warned that if you put BIT
into a table, and you want only binary values, disable NULL
.
If you allow NULL
in a bit field it will actually be trinary and allow three values.
Use the BIT column. In your form just provide a radio button or checkbox. Here is a helpful link of Sql Data Types compared to .NET types: http://msdn.microsoft.com/en-us/library/cc716729.aspx
Use the bit datatype. I would use a checkbox in the gui. If it is not checked then the bit value should be 0, else 1.
One word: bit! (now I am just padding the answer because it is too short)
精彩评论