ServersImages in ASP

Images in ASP




by Armand Datema

Here is a new tutorial on how to include images in ASP. Without using blobs or binary
fields.

Here is a new tutorial on how to include images in ASP.

First we start of with the basic HTML

imagedbase

Now lets create the database connection

set conntemp=server.createobject(“adodb.connection”)
Set con =
Server.CreateObject(“ADODB.Connection”)

Now lets open the database connection,
create the SQL Statement and open the result set,  my
ODBC name here is image and the table i am
going to query is called image

con.Open
“DSN=image;”
Set rs =
server.createobject(“adodb.recordset”)
rs.Open “select *
from image”, con
do While not rs.EOF
%>

The code so far
was pretty standard, creating a connection, opening recordset
and run the query. Now lets go to te interesting part, how to
add the images 🙂

First we need to add a bit
HTML code for the table display

Now lets finish the rest
of the code and close the HTML tags.

rs.moveNext
loop
%>

Image
description
Actual
Image
In the next cell you see the

In the next part of the
code we write the name of the image as plain text.

Some extra HTML code for
the table display

picture

Now we add the image, as you can see
from the line code below, its actually very easy, just put the
response.write … in the place of where you would normally
put the name of the image.  

.gif” width=”100″
height=”100″
>

Latest Posts

Related Stories