I have a grid that when populated may or may not have null values for a column that is a string.
If the data returned is already null everything works fine. If the string column had data and I step into the column and delete all the data I get a message stating that there is a Data Error - Unable to update the data value: Object of type 'System.DBNull' cannot be converted to type 'System.String'.
How can I allow a column to go back to a null value once it contained data?
I have the same problem
with error "Unable to update the data value: Object of type 'System.DBNull' cannot be converted to type 'System.Nullable`1[System.Decimal]'."
It seems the only way is to use CellError event, because I cann't change my Datatype filed to nullable value.
alex_blokha said:Unable to update the data value: Object of type 'System.DBNull' cannot be converted to type 'System.Nullable`1[System.Decimal]'.
To address this, set the Nullable property on the corresponding WinGrid column to "Nothing". This will store an actual null value ("null" in C#, "Nothing" in VB.NET) whenever the cell's value would be null. A Nullable Decimal field knows what to do with this kind of a "null' value.
Ok, it seems i see the algorithm of solution.
I will change null value to 0 before leaving the edited cell.
Please tell me, how can I do it?