Newlogo.gif (8646 bytes)Data Binding - taking image tag SRC URLs from a database






How it works...

This is a great way to present a gallery of holiday snaps on the Web! The images aren't stored in the database - they're in separate .gif and .jpg files on the server (so they don't get downloaded unless you ask for them). Each record in the database contains the name of an image file plus some descriptive text, like this:

PicURL,Description
StMich.jpg,"St. Michael's Mount, near Penzance etc...."
Royalc.jpg,"The Royal Crescent, Bath, is the finest etc..."
Sennen.jpg,"Sennen Cove, near Lands End etc..."

(note that I've enclosed the descriptions in "" marks, so that I can put commas in the text).

The page is really easy to code. Apart from the data source object and the standard navigation buttons, it has an <IMG> tag, bound to the first database field (the data replaces the IMG's .src property, and thus loads the images), and a <SPAN>, bound to the description field. The HTML code goes like this:

<img datasrc="#places" datafld="PicURL" align="left">

and

<span datasrc="#places" datafld="Description"></span>

... and that's all there is to it!


Back to Menu