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

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
 
N

needin4mation

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.
 
N

Nicholas Paldino [.NET/C# MVP]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top