Replacing Nulls in database table

Hello,
I experience the following problem: I have a data table in the database, which includes float and smalldatetime columns. These columns can accept nulls. However when I load the table to the application and fill it to datagrid I do not want the user to see that annoying word "null" in the table. I tried to replace it with empty string but it is impossible since the type of the field is double or datetime.
Does anybody know how to solve this problem

Thanks.



Answer this question

Replacing Nulls in database table

  • BatesManty

    You can set the DataGridColumnStyle.NullText to set the text that is displayed when the column contains a null reference.


    DataGridTableStyle style = DataGrid1.TableStyles["DataTable1"];
    style.NullText = String.Empty;




  • adam kromm

    Check with System.DBNull

    example:

    dtABNORMALFLAGS.Rows[row][col]==System.DBNull.Value.ToString(); << ---- put condition here..

    I hope this is your requirement...let me know if you are still getting the problem.

    Mahes



  • Replacing Nulls in database table