JayCeeChan
01-11-2008, 01:04 PM
Been using this as template for order tracking form. But it doesn't seem to work properly. Anyone know why?
Many thanks for the help
Kind regards,
Jay
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Order Tracking</title>
</head>
<body>
<%
'**********************************************************************************
' This script retrieves the ORDER TRACKING, given a customer
'**********************************************************************************
Dim yourID, rs
registration_CustomerID = 1
'**********************************************************************************
' Hey! This customerID can be retrieved from the Session object, once the customer is logged in!!
'**********************************************************************************
response.Write("Thank you for submitting your details <br>")
'path to the database
pathToDb = "e:\isproot\yr0708\BN3369\Group-14\registration.mdb"
response.write("The status of your orders are summarised in the below table - <br>")
response.write("<br>")
'Open the database
set db= Server.CreateObject("ADODB.Connection")
dbId = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & pathToDb & ";UID=;PWD="
db.Open dbId
'All this boring stuff of the database you already know....
'And of the recordset as well.....
set rs = server.createObject("ADODB.Recordset")
'Define the query needed to find the required data: THIS IS THE BIT THAT MATTERS!
'I've concatenated the SQL statement, just to look nice in Notepad++
SQL = "SELECT UserAccount.Email, UserAccount.CustomerID, OrderTracking.OrderID, OrderTracking.BeginDate, OrderTracking.EndDate, OrderTracking.Operation "
SQL = SQL & "FROM UserAccount, tbl_Order, OrderTracking WHERE "
SQL = SQL & "UserAccount.CustomerID = " & registration_CustomerID & " AND UserAccount.CustomerID=tbl_Order.CustomerID AND "
SQL = SQL & "tbl_Order.OrderID = OrderTracking.OrderID"
'Fill the recordset with the data defined by the query:
rs.open SQL,db, 2, 2
response.Write("If any of the details below seem to be incorrect, please contact us as soon as possible<br>")
'rs.MoveFirst
Response.Write ("<table border = " & chr(34) & "= " & "1" & chr(34) & ">")
Response.Write("<tr>")
Response.Write("<td> Order ID </td><td> Order Placed </td><td> Status </td>")
Response.Write("</tr>")
While Not RS.EOF
Response.Write("<tr>")
Response.Write("<td>" & rs("OrderID") & "</td><td>" & rs("BeginDate") & "</td><td>" & rs("Operation") & "</td>")
Response.Write("</tr>")
rs.MoveNext
wEnd
Response.Write("</table>")
'Close the recordset and the database
rs.Close
response.Write("Closing recordset..")
db.close
response.Write("Closing database..")
%>
</body>
</html>
Many thanks for the help
Kind regards,
Jay
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Order Tracking</title>
</head>
<body>
<%
'**********************************************************************************
' This script retrieves the ORDER TRACKING, given a customer
'**********************************************************************************
Dim yourID, rs
registration_CustomerID = 1
'**********************************************************************************
' Hey! This customerID can be retrieved from the Session object, once the customer is logged in!!
'**********************************************************************************
response.Write("Thank you for submitting your details <br>")
'path to the database
pathToDb = "e:\isproot\yr0708\BN3369\Group-14\registration.mdb"
response.write("The status of your orders are summarised in the below table - <br>")
response.write("<br>")
'Open the database
set db= Server.CreateObject("ADODB.Connection")
dbId = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & pathToDb & ";UID=;PWD="
db.Open dbId
'All this boring stuff of the database you already know....
'And of the recordset as well.....
set rs = server.createObject("ADODB.Recordset")
'Define the query needed to find the required data: THIS IS THE BIT THAT MATTERS!
'I've concatenated the SQL statement, just to look nice in Notepad++
SQL = "SELECT UserAccount.Email, UserAccount.CustomerID, OrderTracking.OrderID, OrderTracking.BeginDate, OrderTracking.EndDate, OrderTracking.Operation "
SQL = SQL & "FROM UserAccount, tbl_Order, OrderTracking WHERE "
SQL = SQL & "UserAccount.CustomerID = " & registration_CustomerID & " AND UserAccount.CustomerID=tbl_Order.CustomerID AND "
SQL = SQL & "tbl_Order.OrderID = OrderTracking.OrderID"
'Fill the recordset with the data defined by the query:
rs.open SQL,db, 2, 2
response.Write("If any of the details below seem to be incorrect, please contact us as soon as possible<br>")
'rs.MoveFirst
Response.Write ("<table border = " & chr(34) & "= " & "1" & chr(34) & ">")
Response.Write("<tr>")
Response.Write("<td> Order ID </td><td> Order Placed </td><td> Status </td>")
Response.Write("</tr>")
While Not RS.EOF
Response.Write("<tr>")
Response.Write("<td>" & rs("OrderID") & "</td><td>" & rs("BeginDate") & "</td><td>" & rs("Operation") & "</td>")
Response.Write("</tr>")
rs.MoveNext
wEnd
Response.Write("</table>")
'Close the recordset and the database
rs.Close
response.Write("Closing recordset..")
db.close
response.Write("Closing database..")
%>
</body>
</html>