How to compare two Date values in two different columns of a table


My application is in VS2008 coded in have a table with three columns

FromDate,Todate and Schedule.FromDate and ToDate will have date values whereas Schedule will have a any of these values(weekly,Monthly,Yearly)

In my Form i have given some provision to the user to check the records.My requirement is The currentdate that is Today's date should be compared with the values of Fromdate and ToDate.First it should be check whether Schedule value is Weekly or Monthly or Yearly.If it is weekly than it should check the record in between fromDate to ToDate with a increment of one week.That means it should first check the first value of fromDate than add 7 days to the value and then again check from fromDate and this should continue till it reaches Todate.

Im trying something like this but its not giving me good logic.
If Schedule = "Weekly" Then
While Today >= FromDate And Today<= ToDate
If Today = fromDate Then
My application Code here
End If
End While
End If
I dont think its making any sense.

Please Guide at the earliest.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!