Syntax error in date in query expression

Results 1 to 8 of 8

Thread: Syntax error in date in query expression

  1. #1
    Steve Bishop Guest

    Default Syntax error in date in query expression

    I&#039ve read the great info on this site but I&#039m still having trouble getting my ASP page to insert a record into a date field. I receive the error "Syntax error in date in query expression ". I&#039ve placed the #&#039s all over the place trying to convince ASP and Access that it is truly a date! Any help is appreciated! ( recognize that the word wrap below is ugly)<BR><BR>Dim Conn<BR>SET Conn = Server.CreateObject("ADODB.Connection")<BR>Conn.Co nnectionString = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=D:inetpubwwwrootIams_UJob GuidesdatabasesSjgchange.mdb" <BR>Conn.Open <BR>&#039update the records<BR>strSQL = "INSERT INTO Requests (PTName, OrigName, Title, EffectiveDate, RequestedDate, Reason, Recommend, BData) VALUES (&#039" & PTName & "&#039, &#039" & OrigName & "&#039, &#039" & Title & "&#039, #" & EffectiveDate & "#, #" & RequestedDate & "#, &#039" & Reason & "&#039, &#039" & Recommend & "&#039, &#039" & BData & "&#039)"<BR>Conn.Execute strSQL<BR><BR>sbishop@toast.net

  2. #2
    Join Date
    Dec 1969
    Posts
    511

    Default RE: Syntax error in date in query expression

    In what format are your dates?<BR><BR>For example:<BR><BR>mm/dd/yy<BR>dd/mm/yy<BR>13th July 1999<BR><BR>Pete

  3. #3
    Steve Bishop Guest

    Default RE: Syntax error in date in query expression

    mm/dd/yy though I can change that easily.. I&#039m not locked into a particular format. Thanks!

  4. #4
    Fred methot Guest

    Default RE: Syntax error in "INSERT INTO" expression

    Hi there, guess what, I&#039m getting the exact same problem with "INSERT INTO" statement BUT only when I use a non-DSN connection toi my database. If I include my database in the System DSN on WinNT, everything works fine... Is there something special I must do when using a non-DSN connection ???


  5. #5
    Steve Bishop Guest

    Default RE: Syntax error in

    This is an article from 4 Guys... (found it on MS newsgroup of all places!)<BR><BR>http://www.4guysfromrolla.com/webtech/063099-1.shtml<BR><BR>OLEDB might be worth a shot... don&#039t know if this will clean up the non-DSN less connection error you were having.

  6. #6
    stephen of ny Guest

    Default RE: you can't use slashes

    you can&#039t use slashes. you will get errors.<BR>you have to put date in a format that doesn&#039t use slashes such as 09-23-99. I hope that helps.

  7. #7
    Steve Bishop Guest

    Default RE: you can't use slashes

    Thanks for the tip. Access doesn&#039t appear to have a date format like you suggest. (Access 97) It does have this format 10-Oct-99 but it still didn&#039t work. I&#039m not sure If I&#039m getting stuck in my SQL statement or if it is firing and having problems with the database. When I set the date field as text it works fine. Do you know how to setup the value of the information so that the SQL statement recognizes it as a date? I&#039ve tried this <BR><BR>#" Date "#<BR> <BR>and this<BR>"# Date #"<BR><BR>and this<BR>&#039"# Date # "&#039<BR><BR>AND this<BR>#&#039" Date "&#039 # <BR><BR>and SQL says the ##&#039s are the problem. Thanks again!

  8. #8
    Steve Bishop Guest

    Default RE: you can't use slashes

    wooops, I used the &&#039s as well, just made a typo in my post.

Posting Permissions

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