Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Annoying syntax error

Reply
Thread Tools

Annoying syntax error

 
 
ree
Guest
Posts: n/a
 
      10-20-2003
For some reason I can't pin point, it is just bugging me like hell.

<%
dim strQuery
strQuery = "UPDATE Gifts SET"
strQuery = strQuery & " GuestSelected = " & cint(guestID)
strQuery = strQuery & ", DateSelected = " & Now()
strQuery = strQuery & " WHERE GiftID = " & selectGiftID' &
";"

Line 47 -> conn.Execute(strQuery)
%>



Error message

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing
operator) in query expression '21/10/2003 12:19:31 AM'.
/selectGift.asp, line 47


Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)

Page:
POST 8 bytes to /selectGift.asp

POST Data:
GiftID=5

Time:
Tuesday, 21 October 2003, 12:19:31 AM


Thanks
 
Reply With Quote
 
 
 
 
Aaron Bertrand - MVP
Guest
Posts: n/a
 
      10-20-2003
> strQuery = strQuery & ", DateSelected = " & Now()

Access requies # to delimit dates, but Access also knows what now() is, so
instead of trying to concatenate from ASP, just say

strQuery = strQuery & ", DateSelected = Now()"

> Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
> [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing
> operator) in query expression '21/10/2003 12:19:31 AM'.


And stop using ODBC.
http://www.aspfaq.com/2126


 
Reply With Quote
 
 
 
 
Tom B
Guest
Posts: n/a
 
      10-20-2003
In access, your dates need to be surrounded by #'s.

"ree" <> wrote in message
news:Xns941B3A5A27B4reehotmailcoom@210.49.20.254.. .
> For some reason I can't pin point, it is just bugging me like hell.
>
> <%
> dim strQuery
> strQuery = "UPDATE Gifts SET"
> strQuery = strQuery & " GuestSelected = " & cint(guestID)
> strQuery = strQuery & ", DateSelected = " & Now()
> strQuery = strQuery & " WHERE GiftID = " & selectGiftID' &
> ";"
>
> Line 47 -> conn.Execute(strQuery)
> %>
>
>
>
> Error message
>
> Error Type:
> Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
> [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing
> operator) in query expression '21/10/2003 12:19:31 AM'.
> /selectGift.asp, line 47
>
>
> Browser Type:
> Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
>
> Page:
> POST 8 bytes to /selectGift.asp
>
> POST Data:
> GiftID=5
>
> Time:
> Tuesday, 21 October 2003, 12:19:31 AM
>
>
> Thanks



 
Reply With Quote
 
Randy Rahbar
Guest
Posts: n/a
 
      10-20-2003
> strQuery = strQuery & " WHERE GiftID = " & selectGiftID' &

What's with the single quote after selectGiftID?

> ";"


You might want to lose that too. Assuming selectGiftID is numeric, change
the last line to...
strQuery = strQuery & " WHERE GiftID = " & selectGiftID


 
Reply With Quote
 
Ray at
Guest
Posts: n/a
 
      10-20-2003

"ree" <> wrote in message
news:Xns941B3A5A27B4reehotmailcoom@210.49.20.254.. .
> For some reason I can't pin point, it is just bugging me like hell.
>
> <%
> dim strQuery
> strQuery = "UPDATE Gifts SET"
> strQuery = strQuery & " GuestSelected = " & cint(guestID)
> strQuery = strQuery & ", DateSelected = " & Now()
> strQuery = strQuery & " WHERE GiftID = " & selectGiftID' & ";"
>
> Line 47 -> conn.Execute(strQuery)
> %>
>
>


Dates are delimited with # in Access databases.


<%
strQuery = "UPDATE Gifts SET"
strQuery = strQuery & " GuestSelected = " & cint(guestID)
strQuery = strQuery & ", DateSelected = #" & Now() & "#"
strQuery = strQuery & " WHERE GiftID = " & selectGiftID

%>


Ray at work


 
Reply With Quote
 
Ray at
Guest
Posts: n/a
 
      10-20-2003
There was a line-wrap issue there in your newsreader. He was actually
commenting out the " & ";"" part. At least that's how I interpreted after
questioning it also.

Ray at work

"Randy Rahbar" <rvrahbarAThotmail.com> wrote in message
news:...
> > strQuery = strQuery & " WHERE GiftID = " & selectGiftID' &

>
> What's with the single quote after selectGiftID?
>
> > ";"

>
> You might want to lose that too. Assuming selectGiftID is numeric, change
> the last line to...
> strQuery = strQuery & " WHERE GiftID = " & selectGiftID
>
>



 
Reply With Quote
 
Randy Rahbar
Guest
Posts: n/a
 
      10-20-2003
> There was a line-wrap issue there in your newsreader. He was actually
> commenting out the " & ";"" part. At least that's how I interpreted after
> questioning it also.


Whoops... yeah, that makes more sense. Thanks


 
Reply With Quote
 
ree
Guest
Posts: n/a
 
      10-20-2003
"Aaron Bertrand - MVP" <> wrote in
news:#:

>> strQuery = strQuery & ", DateSelected = " & Now()

>
> Access requies # to delimit dates, but Access also knows what now()
> is, so instead of trying to concatenate from ASP, just say
>
> strQuery = strQuery & ", DateSelected = Now()"




Thanks guys but for some reason not doing what I did before strangely work
on another page.
 
Reply With Quote
 
ree
Guest
Posts: n/a
 
      10-20-2003

>
> Dates are delimited with # in Access databases.
>
> strQuery = strQuery & ", DateSelected = #" & Now() & "#"
> strQuery = strQuery & " WHERE GiftID = " & selectGiftID
>
> %>



Thanks guys but for some reason not doing what I did before strangely work
on another page.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Syntax error? What syntax error? Assignment fo default values? Mark Richards Perl Misc 3 11-18-2007 05:01 PM
newbie: self.member syntax seems /really/ annoying Charles Fox Python 56 09-18-2007 11:15 PM
Syntax bug, in 1.8.5? return not (some expr) <-- syntax error vsreturn (not (some expr)) <-- fine Good Night Moon Ruby 9 07-25-2007 04:51 PM
stupid annoying form error =?Utf-8?B?bWVuc3V1cg==?= ASP .Net 0 03-04-2006 09:56 PM
Complier error!! error C2059: syntax error : '(' Balaji C++ 3 12-03-2004 11:19 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57