RowFilter
does not support the BETWEEN
operator. It also doesn't support complete sql queries like yours. However, you can specify the WHERE
-clause there to filter the rows of the view:
view.RowFilter = String.Format(CultureInfo.InvariantCulture.NumberFormat,
"BattingAverage >= {0} AND BattingAverage <= {1}", minimum, maximum);
I've used InvariantCulture.NumberFormat
in String.Format
to ensure the english format(dots as decimal separator) in RowFilter
which is required.
Note that you also have wrapped the values with apostrophes which is not allowed on numbers and that you're using textBox2.Text
as input for your minimum and maximum value.