Incorrect SQL in Asp Code

Results 1 to 2 of 2

Thread: Incorrect SQL in Asp Code

  1. #1
    Join Date
    Dec 1969

    Default Incorrect SQL in Asp Code

    I have a date type variable in my Asp code called "CurrentWeek" which has been calculated as follows :<BR><BR>CurrentWeek = Date()-Weekday(Date(),2)+1<BR><BR>Now in my SQL statement in the same code, I&#039ve used the variable in my where clause as follows :<BR><BR>"SELECT ..... FROM table " _<BR>"WHERE Fld = " & CurrentWeek & " _<BR>"Order By ..." ("fld" field is Date Type)<BR><BR>I get the error :<BR><BR>"Microsoft JET Database Engine error &#039 80040e14&#039 <BR> Division by zero "<BR><BR>I know the error is in the WHERE line. Can anyone please tell me where I can possibly go wrong?<BR><BR>Thanks!

  2. #2
    KPW Guest

    Default RE: Incorrect SQL in Asp Code

    Wrap the date with "#" characters, as in:<BR><BR>"WHERE Fld = #" & CurrentWeek & "#"

Posting Permissions

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