kimstar00
10-18-2006, 06:14 AM
i search for a customer id and if the customer id matches the one in the database a table is supposed to be formed containing some information. Why wont my asp file work properly?
Code for my html file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Task 1</title>
</head>
<body>
<h3>Task 1</h3>
<form id="customerform" action="task1.asp" method="get">
<h4>please fill in the following form</h4>
<p>Customer ID <input type="text" name="custID"/><br/>
<p><input type="submit" value="Submit">
<input type="reset" value="Reset"></p>
</form>
</body>
</html>
Code for my asp file
<%@ Language="VBScript" %>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<% set conn = server.createobject("ADODB.connection")
myConn.open "warehouse", "IWSDStudent", "assign2"
cID = request.form("custID")
mySQL = "select orderDate, orderNumber, shippingDate, shipped from orders,"
mySQL = mySQL & "where customerID = " & cID
set myRS = myConn.execute(mySQL)%>
<head>
<title>Task1</title>
</head>
<body>
<% if not(myRS.bof and myRS.eof) then %>
<p>Here are the details of <%=cID%>:</p>
<h3 style="text-align:center">Customer Table</h3>
<table border="1" summary="Customer Details">
<tr>
<th>Order Date</th>
<th>Order Number</th>
<th>Shipping Date</th>
<th>Shipped</th>
</tr>
<% do while not myRS.eof %>
<tr>
<td><%= myRS("orderDate")%></td>
<td><%= myRS("orderNumber")%></td>
<td><%= myRS("shippingDate")%></td>
<td><%= myRS("orderNumber")%></td>
</tr>
<% myRS.movenext
loop%>
</table>
<%else%>
<p>Sorry!! No Such Customer!</p>
<%end if%>
</body>
</html>
Code for my html file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Task 1</title>
</head>
<body>
<h3>Task 1</h3>
<form id="customerform" action="task1.asp" method="get">
<h4>please fill in the following form</h4>
<p>Customer ID <input type="text" name="custID"/><br/>
<p><input type="submit" value="Submit">
<input type="reset" value="Reset"></p>
</form>
</body>
</html>
Code for my asp file
<%@ Language="VBScript" %>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<% set conn = server.createobject("ADODB.connection")
myConn.open "warehouse", "IWSDStudent", "assign2"
cID = request.form("custID")
mySQL = "select orderDate, orderNumber, shippingDate, shipped from orders,"
mySQL = mySQL & "where customerID = " & cID
set myRS = myConn.execute(mySQL)%>
<head>
<title>Task1</title>
</head>
<body>
<% if not(myRS.bof and myRS.eof) then %>
<p>Here are the details of <%=cID%>:</p>
<h3 style="text-align:center">Customer Table</h3>
<table border="1" summary="Customer Details">
<tr>
<th>Order Date</th>
<th>Order Number</th>
<th>Shipping Date</th>
<th>Shipped</th>
</tr>
<% do while not myRS.eof %>
<tr>
<td><%= myRS("orderDate")%></td>
<td><%= myRS("orderNumber")%></td>
<td><%= myRS("shippingDate")%></td>
<td><%= myRS("orderNumber")%></td>
</tr>
<% myRS.movenext
loop%>
</table>
<%else%>
<p>Sorry!! No Such Customer!</p>
<%end if%>
</body>
</html>