Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 18th, 2007, 02:29 PM
Authorized User
Join Date: Feb 2007
Location: , , United Kingdom.
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


Reply With Quote
  #2 (permalink)  
Old February 18th, 2007, 03:50 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Oct 2005
Location: Ohio, USA
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

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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

All times are GMT -4. The time now is 06:34 AM.

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