NeoDBpro boolean - Forum

Forum Navigation
You need to log in to create posts and topics.

NeoDBpro boolean

Как правильно записывать ( Boolean ) в базу данных?
1 или True
У меня почему-то при любом варианте в БД записывается -1
Может кто проверит, не могу понять эта проблема в компоненте или у меня в программе?

What is the correct way to write ( Boolean ) to the database?
1 or True
For some reason, for any option, -1 is written to the database
Can someone check if I can't understand this problem in the component or in my program?

@lolo

When creating a table, you can specify the type of field.

https://neodbprohelp.visualneo.com/Tables.html#dbpCreateTable

@vadim
да, так уже делал, но у меня по чему-то в БД пишется (-1,0)
переделал на обычный (int), пускай будет (1,0)

yes, I already did that, but for some reason I write in the database (-1.0)
changed to normal (int), let it be (1.0)

@lolo

According to this page ... https://www.w3schools.com/sql/sql_datatypes.asp

BOOL Zero is considered as false, nonzero values are considered as true.
BOOLEAN Equal to BOOL

If zero (0) and one (1) ... no trailing decimal points ... do not work as False and True, I suggest you just use a text (String) field and store text like isFalse and isTrue ... makes life a lot less frustrating ... with today's costs for memory and disk storage, the extra bytes per field is not going to cost anything meaningful.

 

luishp has reacted to this post.
luishp

For the database to react with 0=False and 1=True, the field must be Bit (the display in the neo tables is a check)

luishp has reacted to this post.
luishp