John-
>The data is read from an XML file (which is produces by VFP8 SP1 CursorToXML() function) using the DataSet.ReadXml class. When viewed in datagrid the date is displayed as 2004-5-24.
>
>I thought the data was a date type because if the column is sorted it is display in the correct date order.
>
>I have managed to get the filter working using the following
>
>
>DateTime d = DateTime.Today.AddMonths(-18);
>AnimalsVw.RowFilter = "Dob <= '" + d.ToString("yyyy/MM/dd") + "'";
>
>
>If I included { or ^ from your example an error was returned when the code was run.
Then the Dob is a string. My question was meant to prompt you to checking what data type you needed, which tells you the format. My syntax was using FoxPro date literal syntax...just habit if I'm making FoxPro date types. Anyway it helped you get to where you're going.
I expect the sorting is working because of the formatting of the string, yes?
>
>I am a little puzzled why the value has to be converted to a string, if the Dob in the dataview is a date, or is the Dob column in the dataview stored as a string?
Do you know how to check types of data in .NET? You can easily break your program and add a quick watch, for example.