473,473 Members | 1,917 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to retrieve image from db and show in image control in Asp.net 4.0

5 New Member
This is my code
Expand|Select|Wrap|Line Numbers
  1. Public con1 As New SqlConnection("Data Source=ashii\sqlexpress;Initial Catalog=testing;Integrated Security=SSPI")
  2.  con1.Open()
  3.         Dim cmd As New SqlCommand("select max(pid) from photo ", con1)
  4.         Dim k As New Integer
  5.         k = cmd.ExecuteScalar
  6.         Dim cmd1 As New SqlCommand("select photo from photo where pid='" & k & "'", con1)
  7.         Dim p As String
  8.         p = cmd1.ExecuteScalar().ToString
  9.         Image1.ImageUrl = HttpContext.Current.Request.PhysicalApplicationPath + "picture\" + p.ToString
plz help me to solve the error
Jan 16 '13 #1
2 1507
PsychoCoder
465 Recognized Expert Moderator Contributor
What error are you getting?
Jan 17 '13 #2
Frinavale
9,735 Recognized Expert Moderator Expert
So your image is stored in the database?

You either need to store that image as a file on the server in a directory where the web browser can request the file....

Or you need to create a control that retrieves the image from the database and writes it into the output stream to send to the browser based on the id.

I posted such a solution for some one here.

-Frinny
Jan 17 '13 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: MaxH | last post by:
How can I get (and save) the image of a control as a bitmap (or other graphics file format)? Thank you. Max
7
by: ABC | last post by:
I am a total newbie to javascript. I have only done Frontpage. I am trying to do a page of image show----I only managed to find a javascript to create pop up windows for the chosen image. Almost...
0
by: kiran | last post by:
How to set background image for treeview control or transparent color as a background for treeview control in Windows forms..? Regards kiran
6
by: Trint Smith | last post by:
How can I show image thumbnail?? thanks, Trint ..Net programmer trintsmith@hotmail.com *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get...
2
by: rams083 | last post by:
how can i display an image on Image Control from Database, asp.net 2.0 vb? please help me... thank you for your reply...
1
by: basavaraj koti | last post by:
I need to show image using xslt Below provided in my xml and xslt. <?xml version="1.0" encoding="iso-8859-1"?> <?xml-stylesheet type="text/xsl" href="../xyz.xsl"?> <Grade class="03"...
0
by: manjitsarma | last post by:
I need to display an image in 'Image Control' of aspx page.Now the image is displayed in the aspx page itself.But I need to display it in 'Image Control'.This is a map application and the image is...
5
by: faizalahmd | last post by:
How to display image in image control , which is retrieved from the data base . using c# in asp.net regards, FAIZAL AHMED.H
4
by: waqasahmed996 | last post by:
hi to all i want to show image on page in fix size of 300*300. images which have size more than that should also show in that size with same picture quality. is it possible? if yes how can i do...
1
by: Myo Thura Lwin | last post by:
Hello, I am facing one problem with canvas control of Visual Editor on eclipse galileo. I would like to show the image onto canvas in fitted size. But when the image is larger than the...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.