|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Date related question
Hi all,
Just a quick question. I'm trying to do a select statement that takes all records that have been created in my MS Access database within the last 3 days, but I'm having a few problems. I've done SQL statements using dates before, however never using the current date dynamically. Currently, I have a field in the database called "date" with the structure DD/MM/YYYY, and I read somewhere that I should call the Date() inside the ASP script that I'm working on to get the current date. However, I don't seem to be any closer to getting it working. Does anyone have any experience of this, and could point me in the right direction? Thanks, Jaiyan |
|
#2
|
||||
|
||||
|
Code:
SELECT *
FROM TableName
WHERE [dateField] >= DateAdd("d",-3, Now())
date is a reserved word in access. You should change the name of the field to something else. |
|
#3
|
|||
|
|||
|
Ahh excellent. Now() it is. I was wondering why Date() wasn't working
And thanks for the tip about my date field, I'd better work on that too. Thanks again ![]() Jaiyan |
|
#4
|
|||
|
|||
|
Dear all,
tempLastDate = DateValue(Session("LastLoginDate")) SQL = "SELECT count(*) as DateMatch FROM tblLogin WHERE DateLogin > '"&tempLastDate&"'" Set rsNotice = connNotice.Execute(SQL) //line 19 //the value of session("lastLoginDate") is 04/04/2004, dd/mm/yyyy, data type is date/time in microsoft access. //connNotice is just a object connection //tblLogin is a table, DateLogin contains date value which in dd/mm/yyyy format. Error Type: Microsoft OLE DB Provider for ODBC Drivers (0x80040E07) [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression. /project/Code/Home.asp, line 19 Are you have clue how to solve this problem??? thanks. |
![]() |
| Viewing: ASP Free Forums > Database > SQL Development > Date related question |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|