This topic is locked

Show list of customer orders

3/26/2009 9:14:09 AM
ASPRunnerPro General questions
jtksmith author

In the ASPRunner Manual, there is sample code for "Show list of customer orders". My question is, where does this code go? I've tried putting it in the Events for Orders but have had no success. I'm using Live Demo 1 for testing this code.
I've seen a working version of this code somewhere out there, but I can't seem to find it again. If someone knows where this working example is or one like it, I would appreciate it if you would provide the link.

Sergey Kornilov admin 3/26/2009

Use "Insert ASP code snippet" function in Visual Editor and paste this code there.

jtksmith author 3/26/2009

I've done exactly as you suggested, which does insert the Event via a snippet. When I open the Edit page, I receive the following below the Edit Form:
Orders placed by 10248
[codebox]ASP error happened
Technical information

Error number -2147217900

Error description Syntax error (missing operator) in query expression 'where customerid='10248''.

URL /LiveDemo1/Orders_edit.asp

SQL query select OrderID, CustomerID, EmployeeID, OrderDate, RequiredDate, ShippedDate, ShipVia, Freight, ShipName, ShipAddress, ShipCity, ShipRegion, ShipPostalCode, ShipCountry FROM Orders where OrderID=10248

Solution
More info on this error[/codebox]
I'm trying to figure out the Syntax error but have been unsuccessful. If could see a working version, I know I could reverse engineer it.

Sergey Kornilov admin 3/26/2009

According to what I see you supplying customerid as a text ('10248') while your database expects it as a number (10248).
You need to adjust event code so customerid value is not wrapped by single quotes.
If you need help doing this I recommend to post your application to Demo Account (use 'Demo Account' button on the last screen in program). Then open a ticket at http://support.xlinesoft.com sending your Demo Account URL for investigation.

jtksmith author 4/4/2009

According to what I see you supplying customerid as a text ('10248') while your database expects it as a number (10248).

You need to adjust event code so customerid value is not wrapped by single quotes.
If you need help doing this I recommend to post your application to Demo Account (use 'Demo Account' button on the last screen in program). Then open a ticket at http://support.xlinesoft.com sending your Demo Account URL for investigation.


I don't understand. It's not my code, its your code. I'm using ASP Runner Demo 1 to test this. I'm using the code that comes directly out of the ASP Runner manual. How can the code be wrong if it is yours?

jtksmith author 4/4/2009

Below is the exact code that I got out of the ASPRunner Manual under 'Sample Code' - "Show list of customer orders"
[codebox]Sub EditOnLoad()
set rstmp = dal.orders.Query(strWhereClause,"")

CustomerID = rstmp(0)

rstmp.Close : set rstmp = nothing

response.write "Orders placed by " & customerid & "
"

set rsOrders = dal.orders.Query("where customerid='" & customerid & "'","")
do while not rsOrders.eof

response.write "<a target=_blank href=Ordersedit.asp?editid=" &

rsOrders("OrderID") & ">" & rsOrders("OrderID") & "</a> " & rsOrders("OrderDate") & "
"

rsOrders.MoveNext

loop
rsOrders.Close : set rsOrders = nothing
End Sub[/codebox]

Sergey Kornilov admin 4/4/2009

Jeremy,
the code is correct but it doesn't match your database specification.
I recommend to post your application to Demo Account (use 'Demo Account' button on the last screen in program). Then open a ticket at http://support.xlinesoft.com sending your Demo Account URL for investigation.

jtksmith author 4/8/2009

I figured out that the example I'd been looking for was in the Live Demos of the 6.0. Using the code there, I figured out my mistakes. Thank you.