Just starting some work in ASP for the first time. Someone chose this language, I didn't. Have the following.
<%
' First let us create Connection and Recordset objects
Set Conn = Server.CreateObject("ADODB
.Connectio
n")
Set Rs = Server.CreateObject("ADODB
.RecordSet
")
' Open the connection to the ODBC source, in this case
' the Access database
Conn.Open "MyDatabase"
' Now, create the SQL statement
GetOrders = "Select distinct tblorder.orderid, shippingmethodid, shippingid from tblOrder, tblorderitem where tblOrder.OrderID=tblorderi
tem.OrderI
D AND strorderstatus = 'success' AND intwporderid IS null AND tblorderitem.intitemtypeid
= '1' AND tblorderitem.intstatusid= '2' ORDER BY tblOrder.OrderID DESC"
' Execute the SQL statement, and set the recordset object
' to the result of this execution. We obtain the resulting
' records in Rs object
Set Rs = Conn.Execute(GetOrders)
' Use this RecordSet object to populate your HTML output stream
' In this example, we will just write out the last name field
Do While NOT Rs.EOF
Response.Write(Rs.Fields("
OrderID").
value)
response.write(",")
Response.Write(Rs.Fields("
ShippingMe
thodID").v
alue)
response.write(",")
Response.Write(Rs.Fields("
shippingID
").value)
response.write(",")
DIM CurrentShippingID
CurrentShippingID = Response.Write(Rs.Fields("
shippingID
").value)
response.write(CurrentShip
pingID)
GetAddress = "Select * from tblShipping where ShippingID='CurrentShippin
gID'"
Set Rs2 = Conn.Execute(GetAddress)
Response.Write(Rs2.Fields(
"ShippingN
ame").valu
e)
response.write("<br>")
' Move to the next record in the resultset
Rs.MoveNext
Loop
' Close the Recordset object and destroy it
Rs.Close
Set Rs = Nothing
' You might want to release the resources for connection object,
' unless you want to use the same connection again in the later code
Conn.Close
Set Conn = Nothing
%>
Basically loopoing through orders, and want to display the orderID, ShippingMethodID, ShippingID, and then want to use the ShippingID, to query tblShipping to get the name and display that as well. But it is not working. Any idea what is wrong?
Start Free Trial