NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

DataColumn.Sparse

Gets or sets a value indicating whether the column should store data in a fashion optimized for sparse data patterns.

[Visual Basic]
Public Property Sparse As Boolean
[C#]
public bool Sparse {get; set;}
[C++]
public: __property bool get_Sparse();
public: __property void set_Sparse(bool);
[JScript]
public function get Sparse() : Boolean;
public function set Sparse(Boolean);

Property Value

true if the column is marked as a sparse column; otherwise, false. The default is false.

Exceptions

Exception Type Condition
ArgumentException The column already has data stored.

Remarks

This property is useful for irregular data. Setting the property to true indicates that the column is not always there, allowing the system to handle memory and performance better.

The OnPropertyChanged event occurs when the property value is successfully changed.

Example [Visual Basic]

The following example creates a new DataColumn and sets the Sparse property to true.

[Visual Basic]

Private Sub AddColumn()
   Dim cols As ColumnsCollection
   Dim myCol As DataColumn
   Dim myTable As New DataSet1.Tables("Prices")
   cols = myTable.Columns

   myCol = cols.Add("Total")
   With myCol
      .DataType = System.Type.GetType("System.Currency")
      .ReadOnly = True
      .Expression = "UnitPrice * Quantity"
      .Unique = False     
      .Sparse = True
   End With
   
End Sub

See Also

DataColumn Class | DataColumn Members | System.Data Namespace