Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
685
DBNull in UltraGrid
posted

I'm filling UltraGrid with a DataTable.  When I try to filter, it gives an error that DBNull can't be converted to other types.  Is there a way to handle this at the grid-level w/o having to check every single col and every single row?

I've got a lot of cols and a lot of rows so it would be a lot of code and would probably slow it down too much.

Parents
No Data
Reply
  • 29105
    Offline posted

    Hello Sean, 

    I recommend trying to set the Nullable property to Nullable.Null for each ultraGrid column where a null value is considered valid. If this doesn't help I recommend you send us a sample demonstrating the behavior. 

    Quoted from the API

    "
    Different databases deal with null values in different ways. Since the UltraGrid is designed to work with a variety of data sources, it has the ability to query the back end and find out which way to store null values. Depending on the type of connection to the database, this can have a significant impact on performance. If you know how the database handles the storage of null values, you can improve performance by setting the Nullable property to either 1 (NullableNull) or 2 (NullableEmptyString). Setting this value to 0 (NullableAutomatic) will provide a greater range of compatibility, but performance will suffer.

    If the database does not support null values, and you attempt to force the storage of nulls by setting Nullable to 1 (NullableNull), an error will result. If you encounter problems when you attempt to save a record that contains a null value, you can change the setting of Nullable which should fix the problem. In any case, you should implement error-checking code to insure that the storage operation succeeded.

    The setting of this property controls how the UltraWinGrid control will attempt to store the null value. In some cases, the mechanism used for data binding may change the null value before actually committing it to the database."

Children