[thelist] Extracting pictures from a database

Rob Smith rob.smith at thermon.com
Fri May 31 08:25:01 CDT 2002


--
[ Picked text/plain from multipart/alternative ]

Joel,

This code is using ASP to handle the "call". If I've got this (img tags
don't really need the width and height attributes to work, automatic) <img
src=""> thing in a database cell, and I want to insert that in to my text.
so set up the database connection first:

'Can you expound on that?
set handle = Server.CreateObject("ADODB.Recordset")
handle.ActiveConnection = "dsn=Internet_user;uid=Tom;pwd=DickAndHarry;"
handle.Source = "SELECT * FROM dbo.Internet Where fileID=12" 'or whatever
handle.CursorType = 0
handle.CursorLocation = 2
handle.LockType = 3
handle.Open()
handle.movefirst 'optional

then in your .asp code have:
<%=handle.Fields.item("images").value%>Blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah.

You could get fancy and store different pieces of the <img> tag in different
cells and customize the layout based on the user decisions; construct them
on demand.

'What exactly does that code mean?
If you've worked with javascript any you know that the way you call specific
items on a page is kind of picky: window.document.form.name.value. Same way
with the above piece of code: handle.Fields.item("foobar").value   where
handle = file handle in your connection
Fields = all the columns in your table called from your SQL statement
item = "column name"
value = the item in that cell
(the row was selected in your SQL statement)

If this doesn't answer your question, please hit the reply button.

Rob


> <img src="pics/blah.gif" border="0" alt="">
>
> that way you can call it during a web page by
> <%=handle.Fields.item("images").value%>.

Can you expound on that? What exactly does that code mean?

joel
--
For unsubscribe and other options, including
the Tip Harvester and archive of thelist go to:
http://lists.evolt.org Workers of the Web, evolt !



More information about the thelist mailing list