patrick24601 Posted July 7, 2005 Posted July 7, 2005 A SQL Server database stores a bit value as 1 or 0. Visual Basic stores true false as -1 and 0. As far as I can tell every time you read a bit column you are going to have to multiple it by -1 in order to test for true/false in VB? Did I get this right or is there an easier way (without storing the value as an integer in sql server) ? Thanks, Patrick Quote
Afraits Posted July 7, 2005 Posted July 7, 2005 I've got a feeling that Vb treats anything other than a 0 as true (though i might be thinking of something else) which means there would be no problem. Logic wise if you want to test for true use something along lines of Not(Value =false) As false is the same in both cases and and will return true for either 1 or -1. Quote Afraits "The avalanche has started, it is too late for the pebbles to vote"
penfold69 Posted July 7, 2005 Posted July 7, 2005 (assuming the value is stored as a Signed Byte) False = 0 True = "NOT" False: False = 0000 (in binary) True = NOT 0000 (in binary) = 1111 Using Two's complement, 1111 = (-1) so, True = -1 HOWEVER... VB.net will recognise anything that is "not" false as being true! B. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.