>string ds = DateTime.Now.ToString(); >string s = "BackupType=1 AND BackupFinishDate < Convert('" + ds + "','System.DateTime')"; >DataRow[] drs = dt.Select(s, "BackupFinishDate DESC");>The Select gives a FormatException with "String was not recognized as a valid DateTime".
>"BackupType=1 AND BackupFinishDate < Convert('22/09/2007 17:02:31','System.DateTime')"
>string s = String.Format( "BackupType=1 AND BackupFinishDate < '{0}'", DateTime.Now.ToString("u") );PS: ToString() would work too. I like to use universal formats.