Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: Re: Why this SQL command doesn't work?


Message #1 by yhuang@c... on Wed, 1 May 2002 20:09:43
Martin:

I found the bug. It was a typo. I typed "&DraftEDtate&" with a extra 't'. 
It should be "&DraftEDate&". Took me two days to find it out.

Thanks very much for trying to help me.

Cindy

> Cindy:

have you checked that DraftTDate and DraftEDate contain a date and are not 
empty?

Have experienced this same error message when trying to update a date 
field 
with a null value.

Martin


At 03:21  4/25/2002 +0000, you wrote:
>Hi,
>
>I am trying to update records in my Access database, and having problem
>with this error message:
>
>Error Type:
>Microsoft JET Database Engine (0x80040E07)
>Syntax error in date in query expression '##'.
>/tracking1/stateDraft2.asp, line 27
>
>I had no problem to update one date field, but couldn't make it with two
>fields. The fields are all in Date/time format in Access.
>
>My code:
>
><%'******* StateDraft2.asp ************
>
>DraftBDate=Request("txtDraftBDate")
>DraftTDate=Request("txtDraftTDate")
>DraftEDate=Request("txtDraftEDate")
>
>'stateId=Session("stateId")
>'statePass=Session("statePass")
>stateAbbrev=Session("stateAbbrev")
>if stateAbbrev="" then
>Response.write "<BR><BR><BR><BR><h2 align=""center""><font color=""Red"">"
>Response.write "You must sign in before entering this page!</font></h2)
><BR><BR><BR><BR>"
>Response.write "<a href=""Home.htm"">Home</a>"
>
>Else
>
>Set newconn=Server.CreateObject("ADODB.Connection")
>newconn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data
>source=e:\web\Tracking1\Tracking1.mdb"
>
>'****This one doesn't work:*****
>SQLcmd1="Update PROGRESS set DraftBegin=#" &DraftBDate
>&"#,PreDraftToRegion=#" &DraftTDate& "#,DraftEnd=#" &DraftEDtate& "# where
>stateAbbrev='"&stateAbbrev&"'"
>
>'***This one works: ******
>'SQLcmd1="Update PROGRESS set DraftBegin=#" &DraftBDate &"# where
>stateabbrev='"&stateAbbrev1&"'"
>
>newconn.Execute SQLcmd1      '***This is line 27****
>
>%>
>...
>
>I Will greatly appreciate your help!
>
>Cindy


  Return to Index