Help on code
Hi guys i am new to programming in ASP and i am having trouble trying to display a image for each record this is the code below can anybody help me thanks
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Orders</title>
<link href="project.css" rel="stylesheet" type="text/css">
</head>
<body>
<%
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsOrder 'Holds the recordset for the records in the database
Dim strSQL 'Holds the SQL query to query the database
'Create an ADO connection object
Set adoCon =Server.CreateObject("ADODB.Connection")
'Set an active connection to the connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("order.mdb")
'Create an ADO recordset object
Set rsOrder = Server.CreateObject("ADODB.Recordset")
'Initalise the strSQL variables with an SQL statement to query the database
strSQL = "SELECT tblOrders.Firstname, tblOrders.Surname, tblOrders.Telno, tblOrders.Cardno, tblOrders.Item, tblOrders.Itemcode, tblOrders.Qty FROM tblOrders;"
'Open the recordset with the SQL query
rsOrder.Open strSQL, adoCon
'Loop through the recordset
Do While not rsOrder.EOF
'Write the HTML to display the current record in the recordset
Response.Write ("<h1>Order</h1>")
Response.Write ("<br>")
Response.Write("Firstname: ")
Response.Write (rsOrder("Firstname"))
Response.Write ("<br>")
Response.Write("Surname: ")
Response.Write (rsOrder("Surname"))
Response.Write ("<br>")
Response.Write("Telephone: ")
Response.Write (rsOrder("Telno"))
Response.Write ("<br>")
Response.Write("Card Number: ")
Response.Write (rsOrder("Cardno"))
Response.Write ("<img src='..\images<%=rsOrder("Itemcode")%>'>")
Response.Write ("")
'Move to the next record in the recordset
rsOrder.MoveNext
Loop
'Rest server objects
rsOrder.Close
Set rsOrder = Nothing
Set adoCon = Nothing
%>
</body>
</html>
|