0

I have a column in datatable where the columname is "last-updated" and I am trying to use the column name with filter like below

dv.RowFilter = " (last-updated >= #" + Convert.ToDateTime(dateTimePickerStart.Text).ToString("MM/dd/yyyy") + "# And Date <= #" + Convert.ToDateTime(dateTimePickerEnd.Text).ToString("MM/dd/yyyy") + "# ) ";

When I try to build I am getting

"Cannot find colum [last]".

I have tried to add single quote arrounding the column name but still not working.

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
Alston Antony
  • 179
  • 2
  • 13

1 Answers1

3

I think - acts like an arithmetic operator in your case and this RowFilter thinks that last and updated as a two different columns and you try to calculate their differences.

Just wrap them with [] as [last-updated] in it should be fine.

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364