Retrieving Images from SqlServer in ASP .NET
page 1 of 1
Published: 15 May 2002
Unedited - Community Contributed
Abstract
This article is a continuation of my previous article, which talks about Inserting an image to Sql Server. I would recommend to read the above article before continuing this. Compared to inserting an image, retreiving is very simple. The only new thing that we need to write an image is, we need to use the method BinaryWrite of the Response Object. Also we need to set the appropriate content type. In this article, we will discuss about retrieving images from a Sql Server.
by Jesudas Chinnathampi (Das)
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 46190/ 45

Written on: May, 15th 2002.
Introduction

This article is a continuation of my previous article, which talks about Inserting an image to Sql Server. I would recommend to read the above article before continuing this.

Compared to inserting an image, retreiving is very simple. The only new thing that we need to write an image is, we need to use the method BinaryWrite of the Response Object. Also we need to set the appropriate content type. In this article, we will discuss about retrieving images from a Sql Server.

We will be learning the following aspects in this article.
  1. How to set the Content Type?
  2. How to use the method, BinaryWrite

Since we already have data in the table, Person, we will add some statements which retrieves all the rows from the table, person. The following code retrieves all rows from the table, Person.

Code to retrieve image from sql server.
    Public Sub Page_Load(sender As Object, e As EventArgs)

        Dim myConnection As New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))
        Dim myCommand As New SqlCommand("Select * from Person", myConnection)

        Try
            myConnection.Open()
            Dim myDataReader as SqlDataReader
            myDataReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection)

            Do While (myDataReader.Read())
                Response.ContentType = myDataReader.Item("PersonImageType")
                Response.BinaryWrite(myDataReader.Item("PersonImage"))
            Loop

            myConnection.Close()
            Response.Write("Person info successfully retrieved!")
        Catch SQLexc As SqlException
            Response.Write("Read Failed : " & SQLexc.ToString())
        End Try

    End Sub

How it works?

The above example is very very simple. All we are doing is executing a sql statement and looping through all the records. We are displaying only the Image from the table, Person. Before dispalying the image, we first set the contentType. Then we write the image to' the browser using the method, BinaryWrite

Test this Script

Download the code

Click here to download the ASPX page

Conclusion

Thus we saw how to retrieve images from a sql server. Do not forget to read my article which talks about inserting images to a sql server.

Links

Inserting Image to SqlServer
Retrieving Images from SqlServer and displaying in a DataGrid
How to Upload a File?
Textbox Web Server Control

Send your comments to das@aspalliance.com        



User Comments

Title: Thanks a lot for code   
Name: Ajay mishra
Date: 2013-01-29 10:49:21 PM
Comment:
Thank u very much for helping in coding
Title: how to retrive a image from database in image button   
Name: nikhil
Date: 2012-12-17 7:35:16 AM
Comment:
there is a not available aaspx page for download which one u r giving in ur page
Title: How to retrive image & other fields data from table in sql server   
Name: swapnil
Date: 2012-12-06 11:45:50 AM
Comment:
How to retrive image & other fields data from table on web form
Title: how to retrieve imgags from sql with c#?   
Name: anu
Date: 2012-09-20 5:58:20 AM
Comment:
how to retrieve images from sql ? can any one help?
Title: succeed   
Name: sanchita
Date: 2012-04-17 5:21:33 AM
Comment:
thanx a lot..... :)
Title: Retriving Image From Database   
Name: Rahul Tiwary
Date: 2012-02-08 2:56:41 AM
Comment:
Hello Sir This Is Rahul I want to Retrive Image From dataas.
I insert ing image database through Web cam.bt Not Retriving In C#.
How It Is Possible .It Urgent
Title: retrieving more than two image from database   
Name: kadar ali
Date: 2012-01-30 7:03:14 AM
Comment:
retrieving more than two images from database on display is asp:repeater give me code
Title: retrieving image from database   
Name: omal
Date: 2011-12-05 12:06:56 AM
Comment:
\
Title: inserting image   
Name: pranali
Date: 2011-12-02 9:58:30 AM
Comment:
good
Title: Retrieving image and inserting   
Name: Pramod kumar Singh
Date: 2011-09-14 8:23:10 AM
Comment:
Hi,

I am trying to insert the same image which i have retrieved and show on page in image control.

Now I want to insert the image as a new record and don't want to use Uploder control here.

Please someone help me.

Data Type of Image Field in Database is : Image
Title: trt   
Name: trt
Date: 2011-09-14 3:20:38 AM
Comment:
Inserting Image to SqlServer
Retrieving Images from SqlServer and displaying in a DataGrid
How to Upload a File?
Textbox Web Server Control
Title: Image problem   
Name: Jineesh
Date: 2011-07-23 12:11:50 AM
Comment:
i can save images into database but i can't get it my web page, i m using asp.net image control ,i want to display image to image control please help me
Title: code for store and retrieve image   
Name: CHAND MOHAMMAD
Date: 2011-01-29 2:38:31 PM
Comment:
please send me code for save and retrieve image from database in asp.net(c#) its very urgent for my project
my emailid: chand.sagitarius@gmail.com
Title: How to retrieve image ASP.NET from sql server. ..using c# langauge   
Name: MALLIKARJUN
Date: 2011-01-12 11:33:02 AM
Comment:
very nice solution. thanks a lot.
Title: How to retrieve image ASP.NET from sql server. ..using c# langauge   
Name: Pulven
Date: 2011-01-02 8:00:54 AM
Comment:
hOpe you can help me. ..thank you!!
Title: How we retrive image in ASP.NET from sql server....   
Name: VIPIN RAI
Date: 2010-12-02 6:36:05 AM
Comment:
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
cmd.CommandText = "insert into images values(@image)";
if (FileUpload1.HasFile)
{
string filename = "~/image/" + FileUpload1.FileName;
FileUpload1.SaveAs(Server.MapPath(filename));
cmd.Parameters.Add("@image", SqlDbType.NVarChar, 50).Value = filename;
}
else
{
cmd.Parameters.Add("@eimage", SqlDbType.NVarChar, 50).Value = "~/image/Sunset.jpg";
}
con.Open();
cmd.ExecuteNonQuery();
con.Close();

THIS IS MY CODE THROUGH THIS I AM ABLE TO SAVE THE IMAGE IN THE DATABASE SQL SERVER ...BUT I CAN'T DISPLAYED THAT IMAGE ON MY PAGE ...SO PLZZ HELP ME AND SEND THE APPROPRIATE CODE...
Title: retrieve image from database   
Name: sreejith o p
Date: 2010-11-10 8:32:04 AM
Comment:
it is very good.............
thank you very much....
Title: Insert and retrieve image from database   
Name: Sasikumar
Date: 2010-09-24 2:23:17 PM
Comment:
Hi,
this is sasikumar. i am looking for the code Insert and retrieve image from database for a long time but i did't get the solution but i got a good solution from you. Thank you so much for you..
Title: thank   
Name: khoa
Date: 2010-09-21 11:17:40 PM
Comment:
very thank you
it easy
Title: I couldnt get anser   
Name: mulli
Date: 2010-07-17 6:16:38 AM
Comment:
i couldnt get correct answer .....
Title: how to retrieve an image in SQL server using vb.net   
Name: yeahbaby
Date: 2010-07-17 4:25:05 AM
Comment:
Hello,
i juz wanna ask how to retrieve an image in the database... this is my code...
Dim da As New System.Data.SqlClient.SqlDataAdapter(objcommand)
Dim ds As New DataSet()
da.Fill(ds)
Dim bits As Byte() = CType(ds.Tables(0).Rows(0).Item(0), Byte())
Dim ms As New MemoryStream(bits)
Dim bitmap As New Bitmap(ms)
pbphoto.Image = bitmap
While objDataReader.Read
With pbphoto
.Image = Image.FromStream(ms)
.SizeMode = PictureBoxSizeMode.StretchImage

End With
populateData3()

Dim da As New System.Data.SqlClient.SqlDataAdapter(objcommand)
Dim ds As New DataSet()
da.Fill(ds)
Dim bits As Byte() = CType(ds.Tables(0).Rows(0).Item(0), Byte())
Dim ms As New MemoryStream(bits)
Dim bitmap As New Bitmap(ms)
pbphoto.Image = bitmap
pbphoto.Image = objDataReader.Item("iam")
End While


I dont know what will I do with this kind of code please help me this is my email address.... hanz_01999@yahoo.com

Thank you....
Title: How to enter a value in text box C# asp.net   
Name: zarna
Date: 2010-07-07 2:31:27 AM
Comment:
Hey itz urgent plz send me the code for entering the value in text box at run time which should also directly go into SQL server 2000 database on button click event
Title: why retrevind images in databas   
Name: kumar
Date: 2010-06-11 5:49:34 AM
Comment:
hi sir why r u retreving images in database images r displaying directly code is used but why r u using database using images r saved
Title: how to retrieve images from sql2005 database   
Name: enaj
Date: 2010-04-27 12:49:43 AM
Comment:
sir, how can i retrieve images from sql2005 database and display it to a website it will display the student id, student name, and student pic. i already made a table. how can i program it to show the picture to the website using aspx.net vb code? pls help me!!!...
Title: Good   
Name: Maaaaaaaaaaaaaaaaaan
Date: 2010-04-22 7:24:30 AM
Comment:
Excellent...!
Title: Reading Image   
Name: Rabindra
Date: 2010-04-21 7:23:36 AM
Comment:
There is a table Employee with 3 fields such as EmpID int,EmpName varchar(30) and EmpImage image.

In User Interface there is a textbox control and button control.
user has to enter empid then click on button control as soon as click the details of particular employee should display on to details view on the same page..


can u suggest me the code.
Title: putting images i asp.net   
Name: Barth
Date: 2010-02-25 12:56:32 PM
Comment:
help i need to see my images in the browser, but i only see them in the design view.
Title: Not seeing image?   
Name: Mike
Date: 2010-02-19 4:03:52 PM
Comment:
I am only seeing a number where the image should be? Am I storing it wrong or something?
Title: please send the c# code of retriving & storingimages   
Name: pradeepkumar
Date: 2010-01-27 7:25:33 AM
Comment:
can anybody help me how to see image(which image i want to save)at uploading time, when i click on browser or upload button then i want to save that image .
after save image i want to that particular image display in another asp.net page
Title: please send the c# code of retriving & storingimages   
Name: meena
Date: 2010-01-19 5:00:04 AM
Comment:
Good & very useful
Title: Web Site or Project's Solution Source code   
Name: Sharam A
Date: 2010-01-05 1:55:15 PM
Comment:
Is there any way for you to send me Projects (Web Site)source codes for followings:
Inserting Image to SqlServer
Retrieving Images from SqlServer in ASP
Retrieving Images from SqlServer and displaying in a DataGrid
How to Upload a File?
Thanks.
Title: see image at uploading time in Image control   
Name: sanjeev
Date: 2010-01-05 9:07:03 AM
Comment:
can anybody help me how to see image(which image i want to save)at uploading time, when i click on browser or upload button then i want to save that image .
after save image i want to that particular image display in another asp.net page
Title: hello   
Name: puneet
Date: 2009-12-31 4:26:43 AM
Comment:
Can anybody tell me how to retrieve image from database into an image control in asp.net(using vb)
As i have retrieved the image but i want this binary write into an image control
I will be very thankful plz send me the code
Title: db images   
Name: ogolla
Date: 2009-07-21 8:25:46 AM
Comment:
Your article on read/write/upload images was very helpful. Straight to the point. No beating around the bush. Thanks buddy!
Title: SqlServer in ASP .NET   
Name: meganathan
Date: 2009-06-29 5:26:40 AM
Comment:
the most efficient way is to retrieve it using a stored procedure that retrieves and joins the data as necessary, and then sending the results to the application for formatting.good article, i really like it. I am doing a bit on research about SqlServer in ASP .NET and i found also macrotesting www.macrotesting.com to be very good source. Thanks for you article.....
Title: retrieve image path and convert it to image   
Name: Roy
Date: 2009-06-03 5:13:57 AM
Comment:
Hi,I would like to know, how do i retrieve an imagepath and convert it to an image from the database?, please care to share :)
Title: image retreiving   
Name: Ravi
Date: 2009-04-09 8:08:52 AM
Comment:
Hi,
upto inserting the image in database, everything is fine but after retrieving it, the image is not being displayed in the datagrid. I have wrote the all the code in c#. code for Retrieving image is as follows:
Response.ContentType = rd.GetValue(rd.GetOrdinal("studphotoimagetype")).ToString();

byte[] bytearray = (byte[])rd["studphoto"];
Response.BinaryWrite((byte[])rd["studphoto"]);

Plz help me... its very urgent
Title: image retreiving   
Name: rincy
Date: 2009-04-01 3:43:34 AM
Comment:
thnx for this useful code..cany u uggest method to retreive the image into a textarea or to a imagebox ???
Title: itz very good...........................   
Name: uday krishna lukka
Date: 2009-03-20 7:16:25 AM
Comment:
u did a excellent job....4r learners itz really very helpfull
Title: Mr.   
Name: Fakhrul Islam
Date: 2009-03-06 2:43:58 PM
Comment:
Sir i need the code to insert image into database from image button but picture need not to be upload.i have an predefined image in an image button.this predefined image have to insert into SQL server by clicking another button.i also need to retrive image from database using by an emmplyoee ID.
Please sir help me about this.
My email- me.dispose@yahoo.com
Title: image retrieve and store   
Name: sumitra
Date: 2009-02-27 12:09:44 PM
Comment:
Sir,
Please provide solution for image show in database as well as grid view and the images are clickabl.
Title: image retrieve and store   
Name: mahesh
Date: 2009-02-11 12:37:39 AM
Comment:
sir please send me the code to compare the two images in the database and another image coming input from the external device such as the scanner.so i want the code for that.
Title: Retriving image from sqlserver2005 using c#.net   
Name: Ramesh
Date: 2009-02-07 7:01:02 AM
Comment:
this is ramesh reddy.
my mail id is sanrameshreddy@gmail.com.
please provide solution
Title: Retrieving image from thwe database into the image control   
Name: yemo1
Date: 2009-01-28 2:07:37 AM
Comment:
Hi, you're doing a great job.This is really helpful, but I need the code to retrieve the image and display it in the image control. Thanks
Title: retriveing image from database   
Name: Deepak Goyal
Date: 2009-01-21 12:03:22 AM
Comment:
code is good but some problem to retrive image in image control
Title: display the image in the image control   
Name: mohit chauhan
Date: 2009-01-13 5:34:24 AM
Comment:
i want to display the image in the image control from the database .can anybody please help me in this . can you just sent me the code in this mail
please
mohit.chauhan8@gmail.com
vikasparashar320@gmail.com
Title: retrieve image from database into image control   
Name: rubina
Date: 2009-01-06 4:49:57 AM
Comment:
hi,
i want to display the image in the image control after retrieving the image from the database .can anybody please help me in this . can you just sent me the code in my email id rubinarahman@rediffmail.com
Title: how to picture control   
Name: Amol
Date: 2008-10-16 1:06:14 AM
Comment:
hi,
how I can do this with simple picture control.I am unable to do it using the same code.Thanks.
amol@retailrelam.co.uk
Title: How to upload image and retrieve image from database into the gridview control in VB.NET   
Name: veera
Date: 2008-10-07 4:43:22 AM
Comment:
Any one help me to solve this problem
Title: display image in image button   
Name: Himaraj
Date: 2008-09-11 7:22:46 AM
Comment:
dear sir,
I have tried to implement the same in ASp.Net and C#, but i am unable to bind the image, I am not getting the image on the control. So I request you to mail me the code which i amy be able to retrieve images from sql server and need to display it on image button control.
my email id is himaraj.vanaras@gmail.com

Many many thanks
Title: Display the Value   
Name: Abirami.B
Date: 2008-09-02 6:59:46 AM
Comment:
I have create a procedure in database..one for ADD Procedure and Another one For View..i Need how to retrive the value from the database to display the grid view..i need the solution in asp.net With C#
Title: your code   
Name: Chance Keller
Date: 2008-08-20 1:04:00 PM
Comment:
i have used your code it pulls the picture from the database but overides the web page by not displaying the web page but displays the picture only
Title: display image from sqlserver   
Name: HIRAL
Date: 2008-08-05 4:01:56 AM
Comment:
My code is:


Image img;
SqlConn con = new SqlConn();

SqlCommand cmdSelect = new SqlCommand("select location_map from location_master where location_id = @locationID", con.conn);

cmdSelect.Parameters.Add("@locationID", SqlDbType.Int);
cmdSelect.Parameters["@locationID"].Value = iLocationId;
byte[] barrImg = (byte[])cmdSelect.ExecuteScalar();
con.conn.Close();
MemoryStream ms = new MemoryStream(barrImg);
img = Image.FromStream(ms);

BUT I GET ERROR AT LAST LINE i.e. ' img = Image.FromStream(ms);' INVALID PARAMETER
HELP PLZZZZZZ

hiral_b17@yahoo.com
Title: retrieve image from sql database using ImageButton   
Name: qx
Date: 2008-08-01 3:09:19 AM
Comment:
I wanted to retrieve an image in the asp.net page from SQL database using an ImageButton. On click, the image button on the asp.net page will be able to bring user to another page. How do i do that.

Do get back to me at complicated_dreamz@hotmail.com
Title: image assign to image control   
Name: Ahsan
Date: 2008-07-10 4:32:53 PM
Comment:
retrieve image from the DB and place it into an image control on an ASP.NET page?
how can i do it;
help me out
ahsanaimer@yahoo.com
Title: Its Very Helpful   
Name: Bhargavi
Date: 2008-07-08 7:48:51 AM
Comment:
I need to display many images in a single page row-wise which are stored in database using ASP.Net with C#....................Anyone plz kindly help me
Title: Very Nice Article   
Name: yom kadam
Date: 2008-07-04 8:54:53 AM
Comment:
very nice article nitin.it is very helpful
Title: Thanks   
Name: Carlos Willian
Date: 2008-06-11 2:10:13 AM
Comment:
thanks nitin good article
Title: Retrive Images from database using asp.net   
Name: Nitin Khadloya
Date: 2008-06-11 1:43:47 AM
Comment:
i have another easy code to retrive images from database and bind with gridView if anyone want this code Mail me on
nitin.khadloya@gmail.com.
Title: inserting images from the sqlserver   
Name: ramesh
Date: 2008-06-03 6:26:23 AM
Comment:
sir,
i want to update the images from the databases.pls help me on how to read the images and update the images using webpage(in c#.net)my mail d.ramesh005@gmail.com
Title: Retrieving all the images from the sqlserver in a gridview   
Name: shilpa
Date: 2008-05-20 1:16:37 PM
Comment:
Sir,
I wanted to retrieve all the images from the database into
the gridview.Please help me on how to read the images from the sql server database and display it into the gridview in the matrix form. using vb.net

Regards,
email id is :- shilpa.tiwari@yahoo.com
Title: Retrieving image from SQL server 2005   
Name: john
Date: 2008-05-20 2:38:40 AM
Comment:
Sir,
I wanted to retrieve image in the asp.net page using the c#.net and i want to display that image in the page
so what should i do for that.
Title: Excellent   
Name: Amer
Date: 2008-04-16 2:29:15 PM
Comment:
Hi
I used this code to store and retrieve csv, doc, xls, html, gif jpg etc from sqlserver 2005 and it is working perfectly.

Thanks for it.
Title: Retrieving image from SQL server 2000   
Name: Sameer
Date: 2008-04-02 7:51:20 AM
Comment:
Sir,
I wanted to retrieve image in the asp.net page using the c#.net and i want to display that image in the grid format
so what should i do for that.

Regards..
Title: how to store and retrive image and vedio file in sql usin asp.net C#   
Name: karthik
Date: 2008-04-02 7:22:34 AM
Comment:
help me.
asp.net c# source code sednd me.
my mail id notkarthik@gmail.com
Title: how to connect sql server2005 database to asp.net2005   
Name: riveka
Date: 2008-04-02 4:47:36 AM
Comment:
hi,i want the detail and form model for connecting the sqlserver2005 data into asp.net2005.i to establish the connection and what are the step needed to connect.plz tell.my mail id rivekadevii@yahoo.com
Title: images loading dynamically   
Name: krishna kishore
Date: 2008-03-25 11:35:44 PM
Comment:
hi,i want to insert more than one image in one window and by clicking buttons like next or 1,2,3....,i want to display images accordingly.i want code in asp.net using c#.pls help me .my email is krishnakishoremca@yahoo.com.
Title: dynamic reports   
Name: uma
Date: 2008-03-12 7:42:00 AM
Comment:
hi i know static creation of report but i want dynamic report means we have to create by using code pls help its urgent.pls send to dis id uma159@gmail.com
Title: Retrieving GIF Image from SQL Server   
Name: Krupa Parikh
Date: 2008-02-06 5:50:30 AM
Comment:
Hi, It helps me a lot in managing images in our site. Thanks a lot. But I am facing problem why retrieving GIF file. It is not displaying the file in the web browser. Is there any other way to display GIF file. Please let me know asap. Its urgent. Any suggestion is welcome. My emailid is krupa.parikh@gmail.com
Krupa.
Title: retrive images from sqlserver 200   
Name: jahnavi
Date: 2007-12-12 6:08:28 AM
Comment:
hi,
it is helpful but try to link the image in image control.
jahnavi_jeevan@yahoo.co.in
Title: retrieve images from sql server 2000 databses   
Name: veera(developer of phenos)
Date: 2007-12-10 12:19:00 AM
Comment:
how to retrieve the images from sql server2000 db n how to store the images sql server2000 to asp.net datagrid view n datalist control.n then we click the imges open r link goes to the another page.....plz very urgent need sir...(with c# source code)...
my mail is kalai_veera@rediffmail.com,kalai_veera@sify.com
kalai.veera@gmail.com
thanku u............
Title: Retriving of image   
Name: Waheed
Date: 2007-11-24 2:54:31 AM
Comment:
Dear Sir ,


this article is good but
Kindly help me how i retrive an image from database and display it image web control .


My email is waheed_swe2k3@yahoo.com
Title: Good   
Name: Waheed
Date: 2007-11-24 12:00:01 AM
Comment:
Dear Sir,


This article is good and through this i retirive an image from database . but my problem is that i want to display that image in image conrol is asp.net . kindly help me in this problem i tried too much time but no solution found .


Regards
Title: xml page cannot be displayed   
Name: shiva
Date: 2007-11-21 11:54:20 PM
Comment:
sir,
i used your code to retreive the image fron database but it is showing the error CANNOT DISPLAY THE XML PAGE.but when i removed the Response.ContentType = myDataReader.Item("PersonImageType") line it is not showing neither the image nor the error pls help me out very urgent.

please do reply me on shivaece_ksk@yahoo.co.in
Title: answerrrrrrrrrrrr plzzzzzzzzzzzzzzzzzz   
Name: veniza khan
Date: 2007-11-06 1:54:09 PM
Comment:
i think u dont give any answer to ur users.

answer plzzzzzzzzzzzzzzzzzzzzz


ur article is good..
but it does't support my prob that is delete the images and retrieve them by ids..

my e-mail:
elite_onlinz@yahoo.com
Title: delete image and display images more than once   
Name: veniza khan
Date: 2007-11-06 1:47:38 PM
Comment:
ur article is good..
but it does't support my prob that is delete the images and retrieve them by ids..
my e-mail is:elite_onlinz@yahoo.com
i,ll be very thankfull to u dear if u ,ll give me answer
i think u r soooooooooooo swwweeeeeeeeeeeettttttttt
Title: retriving image from database   
Name: Harinath
Date: 2007-08-17 1:34:45 AM
Comment:
hello,
I need to retrive image from database and store it in image control in aspx page. please send solution to hari_4ur@yahoo.com.

Thnaks,
Harinath Pinna
hari_4ur@yahoo.com
Title: how to retrieve image from SQL server to image button   
Name: Ashraf
Date: 2007-08-08 3:44:05 AM
Comment:
i have 5 imagebutton in my page and i have an image stored in sql server. i want retrieve the image from database to corresponding imagebutton. ie using for loop, by using for loop i am moving the record in database, from database the image is retrieved using id.

this is the coding:

For Each row In ds.Tables("ash").Rows
Dim sql1 As String
sql1 = "SELECT u_id,u_filename FROM uploads where u_id=" & b & ""
Dim adap1 As New SqlDataAdapter(sql1, con)
Dim ds1 As New DataSet
adap1.Fill(ds1, "ash")
a = ds1.Tables("nisa").Rows(0).Item("u_filename")

With ImageButton1
.ImageUrl = Server.MapPath("./image/general/" & a)
End With

b = b + 1
i = i + 1
Next
con.Close()

in this imagebutton1, instead of 1 i should be placed, this i is increamented as per coding. if this is done v can place the images to every imagebutton. if u have any idea about this please send ur ideas and coding to ashraf_y25@yahoo.com
Title: how to update an image   
Name: srihari
Date: 2007-08-06 7:56:53 AM
Comment:
can you help me how can insert an image to sql server in asp.net with c#
please sent me this code to sri_ind143@yahoo.com
Title: how to update a images   
Name: anbuvel
Date: 2007-07-25 4:58:04 AM
Comment:
please help me, How to update a images in vb.net using vb coding. i am storing and retriving the images but i dont no how to update the images.
Please Help me.....
Title: Retrving Image   
Name: Mallikarjun
Date: 2007-07-17 1:28:20 AM
Comment:
hai sir
This is mallikarjun i read ur article and i saw the code for retriving images,i have so many doubts can i comunicate with u please,can please give me ur mail id or phone no.this is my mail id and phone no......

mallikarjin.d@gmail.com
09849128621.
Title: Retrieve multiple image from Data Base in ASP.Net with C#   
Name: Faisal
Date: 2007-07-04 12:47:17 PM
Comment:
hi,
i want to retrieve multiple images but it retrieve single image. I also try how to retrieve multiple image in formview but it dont show iamge. and
how the C# code to retrieve an image from a database and show it in a image control and
I need your help Please mail your reply to mes_sramoliya@eofficeplanet.com, mes_fqureshi@eofficeplanet.com

Pls do it urgent.
Title: storing image in a database   
Name: abdul
Date: 2007-06-26 3:03:02 AM
Comment:
very very nice and satisfying
Title: Retrive Image from Data Base in ASP.Net with C#   
Name: Paresh Patel
Date: 2007-06-22 7:30:55 PM
Comment:
Please help me, please give me code for retrive image from database on simple image control in asp.net2005 with C#.

And my Emial ID = paresh_seek_dba@yahoo.co.in
Title: Insert ,update Images in database of asp.net with c#   
Name: komal dowd
Date: 2007-06-18 9:10:53 AM
Comment:
please help me to give me help for ii code for Insert and Update Images in Database sql server 2000 and asp.net 1.1
with c#
Title: Thanks and help   
Name: Masi
Date: 2007-05-31 2:25:25 AM
Comment:
hi,
i want to retrieve multiple images but it retrieve single image. I also try how to retrieve multiple image in formview but it dont show iamge. and
how the C# code to retrieve an image from a database and show it in a image control and
I need your help Please mail your reply to sv_tashakori@yahoo.com
Title: Excellent   
Name: sangram patnaik
Date: 2007-05-26 4:12:08 AM
Comment:
hi,
This is very good enough to get idea about inserting a image using asp.net with sql server.
i having a small doubt. i.e. please send me the query to insert a image to sql server 7 database and retriving query.

thank you
sangram.pk@gmail.com
Title: doubt   
Name: lopamudra
Date: 2007-05-21 8:39:43 AM
Comment:
Data.SqlClient.SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))

what is "connectionstring"?

myDataReader = com.ExecuteReader(CommandBehavior.CloseConnection)

what is "(CommandBehavior.CloseConnection)"?

plz........clarify my doubt.
Title: need help in web service to store and retireve images form sql 2005 using binary data   
Name: mousemee
Date: 2007-05-01 7:45:11 AM
Comment:
HI, i am trying to write a web service that stores and retrieices images form sql server 2005. it is to be working in binary form. meaning, picture is stored not as a pic, but as a long string of characters in database. Does anybody have any relevant codes? Preferbably of c# content.
Title: Hv Problem   
Name: Ajay Vaid
Date: 2007-04-28 3:17:28 AM
Comment:
I Have Proble Where I Create The Table For Storing Image
Title: need help   
Name: chaudhary
Date: 2007-04-19 9:49:08 AM
Comment:
I am storing image in binary format to sqlserver 2005, now i wan to display image with user profile but i am unabale to to display in specific area.
what i am doing same using connection...........string
Response.ContentType = myProfile.MIMEImage.ToString();
Response.BinaryWrite( (byte[]) myProfile.Image);
it is working but its displaying image on whole page and not in my local page its using internet explorer.
need guidence to show the image in specific area with userprofile information.

regards,
JimmyBaba
Title: problem   
Name: sunny
Date: 2007-04-11 5:22:11 AM
Comment:
this code is good.this code is image id goes to next page and then id match to sql id and return the image.but my problem is image and all record display in one page and on e datagrid if you solve the ans then sent the mail sunny_bindr@yahoo.co.in
Title: Please hemp me   
Name: Abhijeet Digraskar
Date: 2007-04-07 1:54:14 PM
Comment:
hello sir
i am developing a site for matrimony in asp.net and backend is mysql 5+ and i want to retrive the images which is save in database in a image control. i can retrive in memorystream but i cannot found any property to show in image control

how can i do this?

please help me and do the needful
my mail id is abhijeet2980@gmail.com
Title: hello sir   
Name: Siddharth jain
Date: 2007-03-30 6:18:47 AM
Comment:
sir,my problem is not solved by your view ,my problem is i have Seven Pictures in one row and i want to retrive images but by your method only one image can retrived,i use c#Coding for that Sql server2000 is my database.please solve my problem.
Title: error   
Name: abha
Date: 2007-03-12 7:36:34 AM
Comment:
respected sir

Your codings help me very much and i m thankful to u as i completed most of my work with the help of these codings... even i m facing problem in retrieving the images cause while writing the code

"Response.ContentType = myDataReader.Item("File1type")
Response.BinaryWrite(myDataReader.Item["File1"]); "

an error generates that the "datareader does not contain the
defination for items" in Asp.net with C#. and every other codes are working properly.

either i hv to add any namespace for this or any other thing i hv to do......

plz reply
i will be very thankfull to you.
my mail : wallcress54sony@gmail.com and
abhson_2004@yahoo.co.in
Title: good   
Name: kolla
Date: 2007-02-24 4:29:09 AM
Comment:
Hey have read ur article... Its really good..n helping...M sure it would be a source for the solution of many problems.....I am developing an intranet website in asp.net.I want to display an image in the image buttton. Heve already stored it in the database in binaryformat. Now am not able to retrive it n display the image in the image button.

can u help me
my mail:seralathans@gmail.com
Title: Hi Fi   
Name: Arun Pal
Date: 2007-02-22 2:53:16 AM
Comment:
this is excelent..
Title: Retriving image from database in image button   
Name: bhoomi
Date: 2007-02-20 6:58:12 AM
Comment:
Hey have read ur article... Its really good..n helping...M sure it would be a source for the solution of many problems.....I am developing an intranet website in asp.net.I want to display an image in the image buttton. Heve already stored it in the database in binaryformat. Now am not able to retrive it n display the image in the image button.
Please help me out for this. Its urgent.....
My mail id is adilovesu_83@yahoo.co.in....
Title: sorry   
Name: sunayana
Date: 2007-02-01 5:42:39 AM
Comment:
dear sir,
i used ur coad to retrive image from databse and it worked but when i use that coad in my project and i retrive image in grid then it display images in whole page so i wana to retrive image only in grid.
Title: Good   
Name: RaviKanth
Date: 2007-01-12 1:07:26 AM
Comment:
Its good article but if we want to retrive the image and show it in the image control means how we can doit iam using .net2003 with aspx pages. if there is any solution please mail me to bkanthravi@yahoo.com.
thanks in advance.
Title: Image Retrieval   
Name: Manjunath A
Date: 2007-01-03 7:08:41 AM
Comment:
Could you please let me know how the C# code to retrieve an image from a database and show it in a image control
Title: Retrieving Image - Problem   
Name: Kumar Gaurav
Date: 2006-12-11 8:01:33 AM
Comment:
The COde is only giving back one image fro the database not all... Please comeback with solution me waiting...

feedback me from allstategroup.com
Title: Excelent   
Name: Sweety
Date: 2006-11-23 7:49:00 AM
Comment:
i want to retrieve multiple images but it retrieve single image. I also try how to retrieve multiple image in dataGrid but it gives error message. I need your help Please mail your reply to mail2usweety@yahoo.co.in
Title: Retrieve Image   
Name: Abdul Basit
Date: 2006-10-10 6:02:12 PM
Comment:
Thanks budy, i get your image retrieve code which really helps me and save my time for the completion of my assignment
Thanks 1's Again
Title: wow! thanxs a lotttt   
Name: vijay
Date: 2006-10-09 3:59:45 AM
Comment:
hi! am so happy now for getting a clear idea to insert and retrive image in a database. Thank u a lot!!!!!!!!!
Title: Image Not retrive properly   
Name: Naveed Qadir
Date: 2006-09-16 1:21:54 PM
Comment:
I have difficulty in displaying image on ASP pages it showes only one image i call single image using "response.binarywrite" when i show all record is show garbige value in the image colum ....................
Title: Excellent code   
Name: Jyotish
Date: 2006-09-14 8:47:44 AM
Comment:
The code works file for a single image field on a record. How to retrieve multiple images from the same record? pl mail your reply to info@sparcindia.com. Thanking you. with best regards.

Jyotish
Title: excellent but small error i think   
Name: rama charan
Date: 2006-08-24 3:53:49 AM
Comment:
iam using visual studio2003 hence asp1.1 with vb.net and sqlserver2000 as backend

i had a pb in that its giving only the last image from database and not all images on the web page ...

i have used the breakpoint and checked it it worked fine as loop repeated for all images and the pb is finally only one img is display probaly i think last one because of overwriting....

one more issue here is that the text statement u have given is not printing at end of image ->" image loaded successfully"
and even text any we give in reponse.write( ) is not printing...

can u explain how concatinate output to reponse.write ()
one plan i got for text is keep alldata in string and finally write it at end using reponse.write can u suggest better one if any...


and finally thanks a lot for your pgms they were great ....wish u good luck bye


ramacharan
Title: EXCELENT   
Name: rajneesk kaur
Date: 2006-08-04 1:19:20 AM
Comment:
it working very well.
thanks
Title: can't display the image   
Name: hendry
Date: 2006-07-26 4:43:33 AM
Comment:
i tried the code..
but can't display any image ..
only
"Person info successfully retrieved! "..
am i missing something here?
Title: What about documents   
Name: Julius
Date: 2006-07-11 5:32:35 PM
Comment:
can this be done to download word documents from sqlserver instead of pics?
Title: imgs Retrieval   
Name: Mandar
Date: 2006-06-30 3:51:39 AM
Comment:
This is regardin an ASP .Net Images from SQL Server DataBase.
I would like to have code to retrieve more than one image from SQL Server to be displayed on Web Page on first load using any with VB or C# with ASP /ASP .Net.
pls mail me ASAP for the following code. Its v v urgent!!!!!.my Email ID: mandarchandorker@hotmail.com

thanx
Title: it works good with images   
Name: ria
Date: 2006-05-19 4:25:35 AM
Comment:
but how do I manage pdf files?
Title: Excelent job for managing image   
Name: john patel
Date: 2006-04-29 5:01:39 AM
Comment:
IT'S VARY NICE CODE THAT HELP ME TO MANAGE IMAGES
Title: hi   
Name: vidya
Date: 2006-04-07 7:48:01 AM
Comment:
i want to retrieve multiple images correponding to one person
kindly help me where to keep them..as in your previous article u used response.binary where we can display only one image
Title: no image display when retrieving images from sqlserver   
Name: irene
Date: 2006-02-28 3:38:25 PM
Comment:
no image is displayed in the datagrid when retrieving from sqlserver and no error occurs. please let me know the possibilities. thank you!
Title: excellent   
Name: mohan
Date: 2006-02-08 2:30:47 AM
Comment:
photon.mohan@gmail.com
mohan@photoninfotech.com
the code is excellent its working perfectely but who can we use the same one using java script coz i need to work on the java script also
Title: Retriving Image is Not Working   
Name: Udai Kumar
Date: 2006-01-19 2:32:13 AM
Comment:
The Code in the above page is working but i could not get the image displayed at the same time how to retrive image from database and assign it to the image control.
Title: very goog   
Name: bob
Date: 2006-01-15 2:18:10 AM
Comment:
great job ,thanks very much
Title: Not working for files other than jpeg---   
Name: Anil
Date: 2006-01-11 9:53:03 AM
Comment:
This Code is not working for other files like winword, Excel, zip etc.....don't know why even though I am specifying the ContentType...
Title: retrieved images are not displaying   
Name: jene
Date: 2005-12-26 5:55:22 AM
Comment:
When i use this code,image is stored properly.but when i retrive it using above code.No image display. However i dont get any error but blank image is displayed.
Title: Well   
Name: Sana Ullah Almani
Date: 2005-12-22 2:50:10 PM
Comment:
Excellent, Very Good...
Title: retrieval of image   
Name: suneesha
Date: 2005-12-16 5:19:08 AM
Comment:
excellent
thanks
Title: Good, and...   
Name: Pat
Date: 2005-11-08 11:06:21 AM
Comment:
What if I want to get one image from the DB and place it into an image control on an ASP.NET page?
Title: C# Image Retrieval Query   
Name: Monika ChoudhARY
Date: 2005-09-29 1:31:12 AM
Comment:
retrieval of image from database using C#
Title: Excelent   
Name: Claudio
Date: 2004-09-14 10:25:23 AM
Comment:
Just whot I need...!!
many thanks






Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-10-14 7:14:46 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search