This documentation is archived and is not being maintained.

Handling Null Values in a Strongly Typed Dataset

In a typed dataset, you can control the representation of columns that contain null values. This behavior is only available when retrieving column values through their typed accessors. If you retrieve the value by means of the table's row index or column index, you will not be able to set the return value.

To set the value to return when a DataColumn's value is null

  1. Open the dataset in the XML Designer.
  2. Select an Element whose type is NOT an unnamed (or anonymous) type.
  3. In the Properties window, select the NullValue property.
  4. Do one of the following:
    • From the drop-down list select the appropriate value:
      ValueDescription
      (Empty)To have null values return as String.Empty .
      (Null)To have null values return as null.
      (Throw)To have null values throw an Exception.
    • - or -
    • Set the property to any custom value.

See Also

String.Empty | ADO.NET Datasets | DataSet Class | DataColumn Class

Show: