Using Date Parameters in SQL statement

Results 1 to 2 of 2

Thread: Using Date Parameters in SQL statement

  1. #1
    Join Date
    Dec 1969

    Default Using Date Parameters in SQL statement

    I want to input a &#039from&#039 and a &#039to&#039 date in a form on a previous page, submit it, and then use those dates in a SQL statement using BETWEEN to only show records that were created between those dates.<BR><BR>I have the form submitting the data ok, I am working with FrontPage2000 which doesnt seem to allow you to validate the format of the text box to a date field. Ignoring the preceeding form I have added some temporary variables:<BR><BR>Start_Date = "12/15/99"<BR>End_Date = "1/15/00"<BR><BR>When I try to use them in the SQL I get a data missmatch error, I have tried using the US dating format i.e. 1/15/99 and the UK 15/1/99 but to no avail. <BR><BR>So basically this amounts to 2 questions, <BR>1)How do I validate the data input into the form on the preceeding page?<BR>2)How do I then use the dates in an SQL statement?<BR><BR>Any advise would be gratefully received<BR><BR>Thanks

  2. #2
    Sathiya Guest

    Default RE: Using Date Parameters in SQL statement

    Remember all the values what you get from TextBox is in character format so you should use CDATE() to convert the start_Date to dateformat --&#062; S_Date = CDate(Start_date)

Posting Permissions

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