问题
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.
回答1:
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.
来源:https://stackoverflow.com/questions/34628778/unable-to-have-dash-in-dataview-filter-c-sharp