Replacing a DateTime.MinValue in a DataGridView

后端 未结 8 1616
悲哀的现实
悲哀的现实 2021-01-17 22:42

I am working on a name record application and the information is stored in a SQLite database. All columns in the database are TEXT types, except for the date of birth column

8条回答
  •  悲哀的现实
    2021-01-17 23:45

    There are already answers that should achieve what you want; but I wonder why you don't put NULL in the database to start with? In sqlite3, "datetime" is more or less just a string, (there is nothing special about a datetime column since sqlite3 is all about just type afinity, not type binding), so you just insert NULL in that column. And in case you want to have the MinValue of datetime when you query, you can easily execute a query like

    select coalesce(your_datetime_column,'01/01/0001') from your_table
    

提交回复
热议问题