Bindingsource.Filter (DateTime conversion problem)

Help!

string d = “30/12/2006 00:00:00”;
DateTime dateFinal = DateTime.Parse(d);

bindingSource.Filter = “RecordCreated < #” + d + “#”;

The one below works! But it’s hardcoded into the filterquery and I am trying to just add it onto the query. Anyone any idea’s?

bindingSource.Filter = “RecordCreated < #10/12/2006 00:00:00#”; <– works but is hardcoded.

Thanks

Wouldn’t you want…


bindingSource.Filter = String.Format( "RecordCreate < #{0}#" , dateFinal );

Hi there,

Thanks for the speedy reply, much appreciated.

I still get this error:

String was not recognized as a valid DateTime.


// I hardcoded this to ensure that
                    // there debugging will be easer
                    // the problem seems to be with
// the format of the dateTime
                    string d = "30/12/2006 00:00:00";
                    DateTime dateFinal = DateTime.Parse(d);


                    bindingSource.Filter = String.Format("RecordCreate < #{0}#", dateTime);

Honestly thought this would have been easier, turns out not so much!

Any other ideas V?

Thanks in advance,
Regards,