Saving a check in SQL

  • Thread starter Thread starter Ana
  • Start date Start date
A

Ana

Hi,
When saving a check from a form into a SQL table (having a field as int), it
is stored as -1 instead of 1.
What's the workaround?
TIA
Ana
 
either 1 or -1 is resolved to 'true'

you should give more information about the trouble that you're facing

-Aaron
 
Ana,

A check-box is a Boolean value - i.e. TRUE or FALSE. (Most?) Databases store
Boolean values as Integers, setting all Bits to 0's for a FALSE value (Hex:
0x00) & all Bits to 1's for a TRUE value (Hex: 0xFF). An integer with all its
Bits set to 1's has an integer value of -1. An integer with value=1 has a hex
representation of 0x01 - i.e. only 1 TRUE Bit in 16.

I'm not too sure I've explained this well, but If this doesn't make too much
sense, then you _really_ need to learn some Hexadecimal basics and how +ve & -
ve integer values are represented.
 
Following up on ckelly's reply, you should probably just change the "int" to
a "bit" field in SQL Server. If you have a good reason not to do that, then
you'll have to use an unbound field for your check-box filling it manually
when you move to a new record, and changing the value manually every time
someone clicks in it.


Rob
 
Back
Top