Search code examples
c#winformsdatatablecube

How to RowFilter a column with a period in the name?


I have a DataTable pupulated from a cube with the column names declared as:

[Measures].[Stock Qty]

The DataTable fills correctly, however when trying to apply a RowFilter using:

"[Measures].[Stock Qty] >= 2000"

I get the following error:

"[Measures.StockQty] not found

I also tried using just the column name:

"[Stock Qty] >= 2000"

but this also fails with a not found error.

Is it at all possible to filter a DataTable using column names that contain periods, if so how?


Solution

  • You can rename the datatable columns (for replacing period with "_") & they try rowfilter.

    Eg.:

    dataTable.Columns["Stock Qty"].ColumnName = 
                     dataTable.Columns["Stock Qty"].ColumnName.Replace(" ", "_");