SQLite Forum



(1) By anthony on 2020-09-07 12:58:12 [link] [source]

i am learning C# and using SQLite database. While setting up a table in SQLite browser, I have checked the NotNull box for a textfield. I have created a simply C# UI program, entered 3 name and purposedly leave 2nd name as empty textbox. When i goes back to check on the database table, it shows all three lines with the 2nd line is empty. I was wondering, why there is not exception or error prompted that Null is not accepted since i have checked the NotNull box for the textfield. It seems the table capture a data even it is empty. Anyone can enlightened me? Thanks.

(2) By Warren Young (wyoung) on 2020-09-07 13:20:49 in reply to 1 [source]

Blank is not null.

(3) By Simon Slavin (slavin) on 2020-09-08 13:19:52 in reply to 1 [link] [source]

Your TEXT field contains a string of no characters. This is not the same as a field containing the value NULL.

You can, if you like, add a check constraint which says that the field must not be the zero-length string.