I am working on a telerik gridview and I supposed to display a warning on certain conditions and 1 of them is that:
if the due date is bigger than today’s date and also the warning days are 3, then it will show all the records who’s due date is bigger than today but only if they come with in warning period then it supposed to show.
so if today’s date is 22-12-2012 and due date is 25-12-2012 and warn days are 3 then it should select that record
what I tried so far:
DateTime dtTodayDate = DateTime.Today;
string strTodayDate = dtTodayDate.ToString("yyyy/MM/dd 00:00:00");
strFilter += @"OR ( [DueDate] >= #" + strTodayDate + @"# AND [Warn_Days] > 0 AND [DueDate] - [Warn_Days] =#" + strTodayDate + @"# )";
Cannot perform ‘-‘ operation on System.DateTime and System.Int32.
You are using the wrong delimiter,
#is used by Access. For SQL Server, just pass your dates as regular strings:But, you should be using parameterized queries instead—there is a good chance you will pass an ambiguous string at some point and not get the date value you think you are getting.