>this.AnimalsVw.RowFilter = "Dob < #" + DateTime.Today.AddMonths(-18) + "#" ; >>
>this.AnimalsVw.RowFilter = "Dob < '" + DateTime.Today.AddMonths(-18) + "'" ; >>
'Dob < 11/24/2002 12:00:00 AM'
I'm sure you can see why that is an error. I think you want something like in the following example:using System; namespace ConsoleApplication3 { /// <summary> /// Summary description for Class1. /// </summary> class Class1 { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main(string[] args) { DateTime d = DateTime.Today.AddMonths(-18); string s = "Dob <= {^" + d.ToString("yyyy/MM/dd") + "}"; Console.WriteLine("DateTime d = '{0}'",d); Console.WriteLine("string s = '{0}'",s); Console.ReadLine(); } } }