Why does JET_coltypBit return 0xFF when set to true?

On our internal mailing list a user asked "When I retrieve a column of type JET_coltypBit that is set to true, why do I get 0xFF and not 0x1"? 


My co-worker Ketan had to reach deep into his memory for the answer 🙂


In the very old days, the Jet API was designed as a replacement for the BC7 ISAM. BC = Microsoft Basic Compiler.


"When Visual Basic converts Boolean values to numeric types, False becomes 0 and True becomes -1."


Now why would do they do this?  Because Basic treated Boolean/Bitwise as being the "same" operation. What does "NOT" do? It flips all the bits; hence

-1 = ~0


Comments (0)

Skip to main content