M
MVM
I am using SQL server and ASP to create a webpage and display images
directly from the database. My code is working fine, the issue I am having
is when a photo is not in the database. For example, we have a table of
homes and a table of photos. Not every home has a photo. So when I search
the photo table for a photo that does not exist I want to display a "No
Image Found" gif. Below is my code.
homedetail.asp:
<img src='photo.asp?GID=" & objRS("GID") & "' width='320' height='240'>
photo.asp:
intGID = Request.QueryString("GID")
....
strSQL = "SELECT PHOTO FROM GIS_PHOTO_VIEW WHERE GID =" & intGID
....
intRecordCount = objRS.RecordCount
If intRecordCount = 0 Then
Response.Write "images/noimage.gif" <--- problem statement
Else
Response.ContentType = "image/jpg"
Response.BinaryWrite objRS("PHOTO")
End If
This works perfect when there is a photo in the database. But when the
record count is 0, it passes the text "images/noimage.gif" back to
homedetail.asp and homedetail displays nothing. How do I get it to pass
the actual image "noimage.gif" back to homedetail.asp?
Thansk!
MVM
directly from the database. My code is working fine, the issue I am having
is when a photo is not in the database. For example, we have a table of
homes and a table of photos. Not every home has a photo. So when I search
the photo table for a photo that does not exist I want to display a "No
Image Found" gif. Below is my code.
homedetail.asp:
<img src='photo.asp?GID=" & objRS("GID") & "' width='320' height='240'>
photo.asp:
intGID = Request.QueryString("GID")
....
strSQL = "SELECT PHOTO FROM GIS_PHOTO_VIEW WHERE GID =" & intGID
....
intRecordCount = objRS.RecordCount
If intRecordCount = 0 Then
Response.Write "images/noimage.gif" <--- problem statement
Else
Response.ContentType = "image/jpg"
Response.BinaryWrite objRS("PHOTO")
End If
This works perfect when there is a photo in the database. But when the
record count is 0, it passes the text "images/noimage.gif" back to
homedetail.asp and homedetail displays nothing. How do I get it to pass
the actual image "noimage.gif" back to homedetail.asp?
Thansk!
MVM