...

View Full Version : select date in asp



new214
03-12-2007, 03:11 PM
Heya al, im programing in asp and have a problem with my sql- when trying to select a date
heres my sql statement it- Im tryingto select the date field but its not working?? Ive tried the #'s but not sure??:-


sub sqlCmd( )
'==SQLSTATMENT============================================
SET objRs = SERVER.createObject( "ADODB.recordSet" )
dim sqlStatment

sqlStatment = sqlStatment + "SELECT * FROM MYTABLE WHERE [trandate] = '22/01/2007' "
sqlStatment = sqlStatment + "ORDER BY [trandate] "

objRs.OPEN sqlStatment,objConn,1,3
'========================================================================================='
end sub

Any sugegstions or coding- welcome thanks
can some one please respond

glenngv
03-12-2007, 06:48 PM
Make sure that the date format you use is the same as that of the SQL server.

degsy
03-14-2007, 04:56 PM
What database are you using?
What data type is your field?
What is the data format?

In Access you can use FORMAT to test against dates if you are having problems comparing
http://codingforums.com/showthread.php?t=109462

In SQL Server you can use Cast or Convert

SSJ
03-15-2007, 01:14 PM
What database are you using?
What data type is your field?
What is the data format?

Provide this...



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum