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?
When you set the column.Nullable property, use the Nullable.Nothing enum value, it gives you null in C# and Nothing in VB.
The Nullable.Null gives you DBNull in the cell.
Default is Automatic, which gives you DBNull if allowed, and empty string else.
john_m,
john_m said:Is it as easy as adding a list item that will map an empty string to the correct type of Null?
I'm bumping into this issue as well. My case is a little more convoluted... there's an UltraCombo being used as the EditorControl.
Any ideas on how I should set up the data in my combo to allow the user to empty out a cell? Is it as easy as adding a list item that will map an empty string to the correct type of Null?
Thanks
Thank you, this advise was helpfull.
alex_blokha,
I've discussed this behavior in more detail with our developers, and we'd like to take a closer look to see if we can handle this situation in a more automatic fashion.
I'm passing the information on this thread to Developer Support, who will create a support case for you.
In the meantime, you should still be able to set the Nullable property of the column appropriate to what the underlying data source expects.