Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Need some help with ASP code

1 view
Skip to first unread message

Ricardoh2000

unread,
Sep 3, 2009, 11:30:01 AM9/3/09
to
This the code inside an ASP file

Set rsPromoSale = MSCS.Execute(strSQL)

If Not rsPromoSale.EOF Then ' They have X in their basket
Do While Not rsPromoSale.EOF
' Response.Write "PROMO: " & rsPromoSale("cond_value") & " - " &
rsPromoSale("award_value") & " - " & rsPromoSale("promo_description") & " - "
& rsPromoSale("name") & " - " & rsPromoSale("parent_dept_id") & " - " &
rsPromoSale("inventory") & " <br> " & vbCrlf

' Add Freebie to Freebie Dictionaries - Setup if needed
If FreeItemsDeptsDict.Exists(""&rsPromoSale("award_value")&"") Then
FreeItemsInvDict(""&rsPromoSale("award_value")&"") =
FreeItemsInvDict(""&rsPromoSale("award_value")&"") + lineItem.quantity
Else
FreeItemsDeptsDict(""&rsPromoSale("award_value")&"") =
""&rsPromoSale("parent_dept_id")&""
FreeItemsInvDict(""&rsPromoSale("award_value")&"") = lineItem.quantity
End If
FreeItemsMAXDict(""&rsPromoSale("award_value")&"") =
rsPromoSale("Total_inventory")

rsPromoSale.MoveNext
Loop
End If

Sometimes we see this pop-up

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the
keyword 'AND'.

/store/basket.asp, line 233

Not sure why? Can someone take a look and see what could be the problem and
line 233 begins with SET rsPromoSale at the top.

--
Thanks,

Rick

Bob Barrows

unread,
Sep 3, 2009, 11:58:32 AM9/3/09
to
Ricardoh2000 wrote:
> This the code inside an ASP file
>
> Set rsPromoSale = MSCS.Execute(strSQL)
>
<snip - not relevant>

> Sometimes we see this pop-up
>
> Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
>
>
>
> [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near
> the keyword 'AND'.
>
>
>
> /store/basket.asp, line 233
>
> Not sure why? Can someone take a look and see what could be the
> problem and line 233 begins with SET rsPromoSale at the top.
>
>
We won't find anything by looking at the code. The only way to debug
syntax errors with a sql statement is to look at the sql statement
itself, not at the code that generated it. Since this is happening
intermittently, you need to trap the error and log the statement that
failed so it can be looked at later on (I don't suggest writing it to
Response since that can give hackers too much info about your database).

'turn on error-handling:
on error resume next
Set rsPromoSale = MSCS.Execute(strSQL)
if err<>0 then
'log the error and sql statement contained in strSQL
'tell the user something went wrong - don't be specific
else
'process the recordset
end if
'turn off error-handling:
on error goto 0

Here is some info about logging errors to a text file:
http://classicasp.aspfaq.com/files/directories-fso/could-i-get-some-help-working-with-files-using-filesystemobject.html

Nothing to do with your problem but:
http://www.aspfaq.com/show.asp?id=2126


--
HTH,
Bob Barrows


0 new messages