Display an image whos image path is stored in a SQL DB

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm fairly new to asp.net. What is the syntax for the string to pull and
image path from a DB and display that image based on the given path? I am
trying to stay away from actually storing images in my DB and want to just
store their paths there. I'd appreciate any help anyone can provide.

Thanks.
JESTER
 
It should be the same as the text for any image source. Just put the
text from the database where the Image source text would normally be.
 
Jester,

What you want to do is have your image tag point to an ASP.NET page
which will take the identifier for the record in the querystring. Then,
that ASP page should change the content type to return the content type for
the image ("image/gif" or "image/jpg" or whateer).

Then, in that page, you would take the unique identifier for the record,
and select the path from the DB. Once you have that, you can copy the bytes
from the file on the server to the response stream.

Hope this helps.
 
Back
Top