Wrox Programmer Forums
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 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, 10:16 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 Displaying a image in asp

hi guys I am trying to get a image to display for each record of a database, each image should relate to each record so there should be diffrent pics for each record im using the following code can any body help me.

<!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("Street: ")
    Response.Write (rsOrder("Firstname"))
    Response.Write ("<br>")
    Response.Write("Number of bedrooms: ")
    Response.Write (rsOrder("Surname"))
    Response.Write ("<br>")
    Response.Write("Duration of Let: ")
    Response.Write (rsOrder("Telno"))
    Response.Write ("<br>")
    Response.Write("Furnished: ")
    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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Displaying Image in a gridview cholletivinod ASP.NET 2.0 Basics 0 July 3rd, 2007 12:29 AM
Image not displaying shoakat ASP.NET 2.0 Professional 2 June 22nd, 2007 10:02 AM
array displaying as image vinodkokane Visual C++ 1 April 23rd, 2007 12:06 AM
Image displaying problem creative_eye VB Databases Basics 0 April 7th, 2006 07:44 AM
displaying an image from file stream into an image sanjeet ADO.NET 0 September 23rd, 2005 10:28 AM

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