Date display in Datagrid
Posted on 2004-09-19
I have an editable datagrid with several date columns, that users need to update at different times.
My SQL server table accepts null for the date column. At first most of columns are null until someone start to enter datas.
If nothing has been entered the datagrid displays an empty cell (which is fine).
If , I update some columns in the datagrid but do not update any date column, the date of 01/01/1900 is automatically generated by the database. After rebinding the datagrid some date columns that are supposed to remain empty now display the 01/01/1900 date. This because the add.paramter in the update event passes an empty string to the database and the field is no longer null.
To work around this problem I am looking for help to create a function that could return an empty string in the datagrid if the date in the database is 01/01/1900.
I have tried to make is work but I am facing casting problems between string, date format...