John,
I haven't actually tried it, but have you tried it without the extra quotes? Either like this:
this.AnimalsVw.RowFilter = "Dob < " + DateTime.Today.AddMonths(-18);
or like this:
this.AnimalsVw.RowFilter = "Dob < " + DateTime.Today.AddMonths(-18).ToString();
~~Bonnie
>I am trying to set a filter on a dataview to show all animals over 18 months. Here is the code I have tried.
>
>
>this.AnimalsVw.RowFilter = "Dob < #" + DateTime.Today.AddMonths(-18) + "#" ;
>
>
>and I have also tried
>
>
>this.AnimalsVw.RowFilter = "Dob < '" + DateTime.Today.AddMonths(-18) + "'" ;
>
>
>Neither on the filters works either causing an error or just not filtering any animals.
>
>I am using C# and the compact framework.
>
>Thanks for any pointers.
>
>John