Professional Documents
Culture Documents
Dispaly Images
Dispaly Images
Like every other website we use cookies. By using our site you acknowledge that you have read and
understand our Cookie Policy, Privacy Policy, and our Terms of Service. Learn more
13,830,130 members
Sign in
Top of Form
MenuBarForm
Password
true Sign in
Bottom of Form
Sign in with
<a href="https://pubads.g.doubleclick.net/gampad/jump?iu=/6839/lqm.codeproject.site/Web-
Development/ASP/Howto&sz=728x90&c=822117"><img
src="https://pubads.g.doubleclick.net/gampad/jump?iu=/6839/lqm.codeproject.site/Web-
Development/ASP/Howto&sz=728x90&c=822117" width="728px" height="90px"
target="_blank"/></a>
Top of Form
Search within:
Articles
Quick Answers
Messages
Bottom of Form
home
articles
Latest Articles
Top Articles
Posting/Update Guidelines
quick answersQ&A
Ask a Question
View C# questions
discussionsforums
Application Lifecycle>
Running a Business
Sales / Marketing
Work Issues
ASP.NET
JavaScript
C / C++ / MFC>
Managed C++/CLI
C#
Free Tools
Database
System Admin
Java
Linux Programming
.NET Framework
Android
iOS
Mobile
SharePoint
Silverlight / WPF
Visual Basic
Web Development
featuresstuf
Competitions
News
Newsletter archive
Surveys
Product Showcase
Research Library
CodeProject Stuf
communitylounge
Who's Who
The Lounge
The Soapbox
Press Releases
help?
What is 'CodeProject'?
General FAQ
Ask a Question
Site Map
Advertise with us
About our Advertising
Employment Opportunities
About Us
Com <a
ment href="https://pubads.g.doubleclick.net/gam
s (52) pad/jump?
iu=/6839/lqm.codeproject.site/Web-
Add 1 2 3 4 5 Development/ASP/Howto&sz=160x600&c=4
your 46207"><img
own 4.44/5 - 40 votes src="https://pubads.g.doubleclick.net/gamp
altern ad/jump?
1 removed
ative iu=/6839/lqm.codeproject.site/Web-
versio μ 4.37, σa 1.43 [?] Development/ASP/Howto&sz=160x600&c=4
n 46207" width="160px" height="600px"
Tagge target="_blank"/></a>
Rate
d as vote 1vote 2vote 3vote
Vote!
Go to top
this:
Win2 4vote 5
K
Win2 Please Sign up or sign in to vote.
003
This article describes how to display images
ASP which are stored in database in either SQL Server
or MS Access.
Wind
ows Download source code - 2.2 Kb
Visual Introduction
-
This article describes how to display images
Studi
which are stored in a database. You can use
o
<IMG> tag to display images stored in the
Stats database by calling another ASP page in SRC
attribute of <IMG> tag.
400.4
K For example:
views
Hide Copy Code
6.1K
<IMG SRC="ShowPicture.asp?PhotoId=1">
down
loads where PhotoId is the ID stored in the database.
user_id (AutoNumber)
user_name (Text)
Code
'Declare Variables..
Dim sql
Dim rs
Dim conn
Dim userID,str
userID = Request("PhotoId")
'Instantiate Objects
Set conn =
Server.CreateObject("ADODB.Connection")
Set rs =
Server.CreateObject("ADODB.Recordset")
'Open connection
Conn.Open "Provider=Microsof.Jet.OLEDB.4.0;"
&_
Response.End
Response.ContentType = "image/gif"
Response.BinaryWrite(rs("user_photo"))
end if
conn.Close
set rs = Nothing
Response.ContentType = "image/jpg"
<IMG SRC="ShowPicture.asp?PhotoId=1">
<IMG SRC="ShowPicture.asp?PhotoId=2">
Upload Image
ENCTYPE="multipart/form-data"
NAME="UploadForm">
<center>
</center>
<BR>
<center><INPUT TYPE="SUBMIT"
VALUE="Upload"
id=SUBMIT1 name=SUBMIT1></center>
</FORM>
Dim myupload
'declare variables..
intCount=0
Set myupload =
Server.CreateObject("aspSmartUpload.SmartUplo
ad")
myupload.Upload
'Create Connection
Set Conn =
Server.CreateObject("ADODB.Connection")
Conn.Open
"Provider=Microsof.Jet.OLEDB.4.0;" & _
Set Rs =
Server.CreateObject("ADODB.recordset")
Rs.Open "SELECT
user_id,user_name,user_photo FROM users",
Conn,3,3
file.FileToField Rs.Fields("user_photo")
Rs("user_name") =
myupload.Form("USERNAME")
Rs.Update
intCount = intCount + 1
End If
Next
Comments
<a
href="https://pubads.g.doubleclick.net/gampad/j
ump?iu=/6839/lqm.codeproject.site/Web-
Development/ASP/Howto&sz=300x250&c=82211
7"><img
src="https://pubads.g.doubleclick.net/gampad/ju
mp?iu=/6839/lqm.codeproject.site/Web-
Development/ASP/Howto&sz=300x250&c=82211
7" width="300px" height="250px"
target="_blank"/></a>
License
Share
facebook
linkedin
google+
Om Prakash Pant
Web Developer
India
No Biography provided
Bottom of Form
<a
href="https://pubads.g.doubleclick.net/gampad/j
ump?iu=/6839/lqm.codeproject.site/Web-
Development/ASP/Howto&sz=728x90&c=822117
"><img
src="https://pubads.g.doubleclick.net/gampad/ju
mp?iu=/6839/lqm.codeproject.site/Web-
Development/ASP/Howto&sz=728x90&c=822117
" width="728px" height="90px"
target="_blank"/></a>
Top of Form
55368 fm
Bottom of Form
Top of Form
55368 fid=55368&floc=%
/Articles/7246/Ar Relaxed
Spacing Layout
Open All 25
Per page
Update
Bottom of Form
First PrevNext
displaying images in
an access database 14-Dec-
using asp Member
18
14058174
Member 1405817414- 12:14
Dec-18 12:14
My vote of 4
Error Type:
Server object, ASP 0177 (0x800401F3)
Invalid class string
/Test/pp_details.asp, line 22
22 Set myupload =
Server.CreateObject("aspSmartUpload.SmartUplo
ad")
23 myupload.Upload
Please help.............
<%
'Declare Variables
Dim sql
Dim rs
Dim conn
Dim RecordId,str
RecordId = Request("MyId")
If RecordId = "" Then RecordId = 1
'Open connection
Conn.Open
"Provider=Microsof.ACE.OLEDB.12.0;Data
Source=F:\HMA Student
Database\StudentDB.accdr;"
Thanks,
Scott
My vote of 5
Member 12-Feb-
Member 204452912- 2044529 11 1:40
Feb-11 1:40
good article
Sign In·View Thread
My vote of 4 8-Aug-
codemoreforless8- codemoreforless 10
Aug-10 11:50 11:50
RbmBinaryImage
26-Apr-09
rmostafa26-Apr-09 rmostafa
22:49
22:49
Regards
Ramy Mostafa
Sign In·View Thread
Hi!
for ex:
1 row: "checkbox" Car "textbox" Red color
2 row: "checkbox" Car "textbox" Yellow color
3 row: "checkbox" Bicycle "textbox" Green
color
4 row: "checkbox" Scooter "textbox" Red and
white color
5 row: "checkbox" Bicycle "textbox" Black
color
Message Closed
mayurmv 5-Sep-08 18:24
5-Sep-08 18:24
Message Closed
I want Code for serch
data statewise from all
state 4-May-08
influxsam
21:30
influxsam4-May-08
21:30
sahayogi id
name
State
City
500313285
Bhabesh Chandra Deka
Assam
HAILAKANDI
500361131
Rejia Khanam Laskar
Assam
Hailakandi
500304202
Anamika Sinha
Assam
Panchgram
500163536
Panchali Dutta
Assam
panchgram
500224724
Allied agencies
Assam
SILCHAR
500296411
Anjan Shee
Assam
Silchar
500150836
Deblina Partha Deb
Assam
Silchar
500321819
Gitika Nath
Assam
Silchar
500156429
Jaruk Ahmed Choudhury
Assam
Silchar
500229499
Ramesh Chhetri
Assam
Silchar
500125807
Ranbir Kar
Assam
Silchar
500228951
Susmita Naha
Assam
Silchar
500021734
Arun Sahu
Chhatisgarh
MAHASAMUND
Sign In·View Thread
Jstncase,
Thanks,
Scott
Thanks
10-Feb-08
drweb8610-Feb-08 drweb86
22:54
22:54
Appreciated,
Srikanth..
Sign In·View Thread
Bilal Haider1-Aug-07
5:22
Hi,
Regards,
Bilal
string fType =
FileUpload_AdPicture.PostedFile.ContentType;
if (fType == "image/pjpeg" || fType ==
"image/bmp" || fType == "image/gif")
{
FileInfo file = new
FileInfo(FileUpload_AdPicture.PostedFile.FileN
ame);
string tempstring = file.Extension;
string filename = "ImageAd" +
DateTime.Now.ToString("yyyyMMddhhmmssff
") + tempstring;
filepath = "Upload/" + filename;
try
{
FileUpload_AdPicture.SaveAs(Server.MapPath(
filepath));
}
catch (Exception ex)
{
Response.Write(ex.Message);
return;
}
}
No duplicate files
10-May-07
dlbdennis10-May-07 dlbdennis
18:49
18:49
ThankYOu
Response.ContentType = "image/jpg"
The image is stored on a database that is in
the same folder as the image and the .asp
page.
Sign In·View Thread
Hello all,
Response.BinaryWrite(row("empPhoto"))
Thanks in advance,
Tony
Dim ID As String
ID = Request.QueryString("ID")
cmd.Parameters.AddWithValue("@empID", ID)
myConnection.Open()
adapt.Fill(table)
Response.BinaryWrite(row("empPhoto"))
myConnection.Close()
Sign In·View Thread
hi,
pls some one respond ........
<%
' Clear out the existing HTTP header
information
Response.Expires = 0
Response.Bufer = TRUE
Response.Clear
%>
<%
Dim vAppRefNo
vAppRefNo =
Request.QueryString("AppRefNo")
Dim vImage
vImage = Request.QueryString("Image")
%>
Set cn =
Server.CreateObject("ADODB.Connection")
'cn.CursorLocation = adUseClient
Set rs =
Server.CreateObject("ADODB.Recordset")
cn.Open "Provider=MICROSOFT.JET.OLEDB.4.0;
Data Source=" & path2DB &""
'Client Data Retrieval
'dim clnt
'for each k in Request.ServerVariables
' clnt = clnt & k & "=" &
Request.ServerVariables("k") & "
" & vbcrlf
'next
'Response.Write clnt
'clnt=Request.ServerVariables("remote_addr")
Else
Response.End
IsImgAvailable = "1" '1 - false case
End If
'DeAllocate Resources
if rs.State = 1 then rs.Close
if cn.State = 1 then cn.Close
Set rs = Nothing
Set cn = Nothing
%>
My code is Below..
****************************************
****************
Dim myupload
'declare variables..
intCount=0
'Create Connection
Set Conn =
Server.CreateObject("ADODB.Connection")
Conn.Open
"Provider=Microsof.Jet.OLEDB.4.0;"& _
' "Data Source=" Server.MapPath("data.mdb")
Set Rs = Server.CreateObject("ADODB.recordset")
Rs.Open "SELECT user_id,user_name,user_photo
FROM users", ConnData,3,3
thankyou in Advance..
Select Language ▼
Original text