Dynamic Image Problem
Can anyone spare a few moments to help me out. Whilst working my way through âBeginning ASP 3.0â I am trying to construct some pages of my own. I need to display a jpg image from a reference to it which is stored in a database table. Later I intend to add a form which lets the user select the image they want but, at this stage I want to display, as default, the image which is named in the last record of the table.
The book doesnât seem to deal with dynamic images at all so could you take a look at my code or suggest where I might go to find out how to do this.
Thanks
<% Option Explicit %>
<!-- METADATA TYPE="typelib"
FILE="c:\program files\common files\system\ado\msado15.dll" -->
<html>
<head>
<title>Cracked Flag MuzikMaze</title></head>
<body>
<%
'To select and display the latest MuzikMaze puzzle by collecting
'the name of the jpg file from the last record in rant.mdbâs MuzikMaze table.
Dim objConn, objRS, strJPGFilename
Set objConn = Server.CreateObject("ADODB.Connection")
Set objRS = Server.CreateObject("ADODB.RecordSet")
objConn.Open = "Provider=Microsoft.Jet.OLEDB.4.0;"&_
"Data Source=C:\databases\rant.mdb;"&_
"Persist Security Info=False"
objRS.Open "Muzikmaze" , objConn, adopenStatic, adLockReadonly, adCmdTable
objRS.Movelast
strJPGFilename = "MuzikMaze/"& objRS("Filename") &".jpg"
Response.Write "<img src=" & strJPGFilename & ">"
objRS.Close
objConn.Close
Set objRS = Nothing
Set objConn = Nothing
%>
</body>
</html>
All I get in explorer is an image placeholder with a red cross. Obviously not right there!
If I change the key line Response.Write toâ¦
Response.Write â<img sce = â & EVAL(strJPGFilename) & â>â
Then I get this messageâ¦
Microsoft VBScript runtime (0x800A01F9)
Invalid or unqualified reference
/BegASP/CFRants/latestmaze.asp
Am I even on the right lines?
All help gratefully received
Pete
|