Wrox Programmer Forums
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old February 18th, 2007, 02:29 PM
Authorized User
Join Date: Feb 2007
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to dhillon555
Default 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">
<link href="project.css" rel="stylesheet" type="text/css">
'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


'Rest server objects
Set rsOrder = Nothing
Set adoCon = Nothing


Old February 18th, 2007, 03:50 PM
Wrox Author
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons

cross post: http://p2p.wrox.com/topic.asp?TOPIC_ID=56474

================================================== =========
Read this if you want to know how to get a correct reply for your question:
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET


Similar Threads
Thread Thread Starter Forum Replies Last Post
Urgent:hard disk serial code and vb code ivanlaw Pro VB 6 0 July 25th, 2007 04:05 AM
VB: .Exe file, serial code and activation code ivanlaw Pro VB 6 8 July 6th, 2007 05:44 AM
code clinic - Why wont example asp code work? jardbf Classic ASP Basics 3 April 27th, 2006 06:22 PM
Writing Client Side Script from Code-Behind code sajid_pk Classic ASP Databases 1 January 18th, 2005 12:53 AM
disable forum code within [code] blocks? nikolai Forum and Wrox.com Feedback 0 October 23rd, 2003 07:52 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.