|
-
May 6th, 2000, 01:26 PM
#1
Thread Starter
New Member
How to display images stored in database through
Response object.(Suppose image is stored in
Access Database)
-
May 7th, 2000, 06:09 AM
#2
New Member
Images and Databases
Originally posted by prasad
How to display images stored in database through
Response object.(Suppose image is stored in
Access Database)
The best thing to do is to store the location of the graphic files in your database, and use the location of the graphic file with your response object.
I do this with .pdf files all the time. The location of the .pdf file is stored in the database, and I use that text string to create a link to the .pdf file.
Sue
-
May 7th, 2000, 07:11 AM
#3
Rather than giving you an opinion how 'bout an answer? The following assumes that you already have the images in sql server or access:
Code:
<%
Dim rec
Set rec = Server.CreateObject ("ADODB.Recordset")
' picId is whatever you use to identify your records
rec.Source = "SELECT picPhoto, picId FROM picData WHERE picId=3"
' Assume you already have an open connection named 'cn'
rec.ActiveConnection = cn
rec.Open
If Not (rec.BOF And rec.EOF) Then
Response.ContentType = "image/jpeg"
Response.BinaryWrite rec("picPhoto")
Else
Response.Redirect "YourErrorPage.asp"
End If
rec.Close
Set rec = Nothing
%>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|