I wonder if someone can help me get my head around a problem I have which should be simple to work out, but it's making my head spin!
I have an ASP.NET form which gets a variable from the querystring for the period - it'll either be: M, LM or 2M (month to date, last month, 2 months ago).
What I am trying to do is get a variable which I can pass to a SQL statement that will get all records from a database where the dates come under one of the above 3 dates.
So for example, if the period is M (month to date) then I can select all records from the table where the dates are within the current month.
I can figure out the LM and 2M by using DateTime.Now.Month - 1 or DateTime.Now.Month - 2, but where do I go from there?
I hope this makes sense...
Thanks in advance for any advice
I have an ASP.NET form which gets a variable from the querystring for the period - it'll either be: M, LM or 2M (month to date, last month, 2 months ago).
What I am trying to do is get a variable which I can pass to a SQL statement that will get all records from a database where the dates come under one of the above 3 dates.
So for example, if the period is M (month to date) then I can select all records from the table where the dates are within the current month.
I can figure out the LM and 2M by using DateTime.Now.Month - 1 or DateTime.Now.Month - 2, but where do I go from there?
I hope this makes sense...
Thanks in advance for any advice