I'm trying to do announcement page with asp.net c# and sql server.
In this page i have "popup" field in datebase and if this field checked I want to show this anouncement code in tinybox like this.
https://i.sstatic.net/dj4Km.png
Its working but I have a problem with dates.
I want to list last "popup" checked field and if this field between the two dates. My sql query looks like this:
Select Top 1 *
From duyurlarx
Where ([popup] = 1)
And tarih
BETWEEN convert(date, getdate())
AND DATEADD(day,popupsure,convert(date, getdate()))
Field explanation:
tarih = date field
popupsure = day count for popup show
This means if "tarih" field = 01.02.2014 and "popupsure" field = 3, then this announcement will be shown until 04.02.2014.
However, when I change the date field to 1 or 2 days before, it's not working. Am I doing something wrong?