How to filter by Month using Dataview.RowFilter

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

My Code:

dvM1.RowFilter = "DATEPART(Month, Datum) = " + Monat.Month + " AND
DATEPART(Year, Datum) = " + Monat.Year;

But DATEPART is not a ADO Functions?

Can someone help me?
 
Dr_Franz,

No, it isn't. If you want to filter on these things then you have to
have separate columns which you want to perform the filter on. In this
case, it would be a column that has the year, and a column that has the
month.

Now, what you could do is actually have a column with the date format in
a string like so:

yyyyMMddhhmmss

And then you could use string comparisons in your filter. So if you
wanted something for one particular month, you could do:

"column like '" + Monat.Year + Monat.Month + "*'"

This way, anything in that month would be selected.

Hope this helps.
 
Back
Top