Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Nov 2006
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up select date in asp

    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??:-

    Code:
    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
    Last edited by new214; 03-12-2007 at 04:50 PM. Reason: no response

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,048
    Thanks
    0
    Thanked 251 Times in 247 Posts
    Make sure that the date format you use is the same as that of the SQL server.

  • #3
    Senior Coder
    Join Date
    Nov 2002
    Location
    North-East, UK
    Posts
    1,265
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #4
    SSJ
    SSJ is offline
    Regular Coder
    Join Date
    Mar 2007
    Posts
    230
    Thanks
    0
    Thanked 4 Times in 4 Posts
    What database are you using?
    What data type is your field?
    What is the data format?
    Provide this...


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •