![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi all, I'm trying to find records in an SQL table that are newer than a specified date. Vie the code. TheDueDate = DateAdd("d",-1,FormatDateTime(Date)) Response.write TheDueDate & "<br><br>" rs.Open "Select * From [StudentWorkDue] WHERE [DueDate] >= '" & TheDueDate & "'", conn, 1,2 Do while not RS.EOF Response.write rs.fields(1) & "<br>" rs.movenext loop rs.close If say, I want to display all records in my [StudentWorkDue] table newer than 03/08/2009, stored in my SQL Server 2005 database, and the [DueDate] |
|
column is a "smalldatetime" I'm absolutely stumped as to why this, or any other expression I try, CONTINUALLY returns the 31/07/2009! Notice the code is trying to return due dates that are newer than yesterday (but including yesterday as well). I'm aware there are difficulties doing arithmetic on dates, but I'd LOVE to know where I'm going wrong! |
#3
| |||
| |||
|
|
Hi all, I'm trying to find records in an SQL table that are newer than a specified date. Vie the code. TheDueDate = DateAdd("d",-1,FormatDateTime(Date)) Response.write TheDueDate & "<br><br>" rs.Open "Select * From [StudentWorkDue] WHERE [DueDate] >= '" & TheDueDate & "'", conn, 1,2 Do while not RS.EOF Response.write rs.fields(1) & "<br>" rs.movenext loop rs.close If say, I want to display all records in my [StudentWorkDue] table newer than 03/08/2009, stored in my SQL Server 2005 database, and the [DueDate] column is a "smalldatetime" I'm absolutely stumped as to why this, or any other expression I try, CONTINUALLY returns the 31/07/2009! Notice the code is trying to return due dates that are newer than yesterday (but including yesterday as well). I'm aware there are difficulties doing arithmetic on dates, but I'd LOVE to know where I'm going wrong! |
#4
| |||
| |||
|
|
rs.Open "Select * From [StudentWorkDue] WHERE [DueDate] >= '" & TheDueDate "'", conn, 1,2 |
#5
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |