.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

How to retrieve image from database

Posted By: rashmi     Posted Date: May 24, 2011    Points:5   Category :C#
how to retrieve image from database in C#.

Author: Sunil Yadav       [Moderator]      
Posted Date: May 24, 2011     Points: 20   
Author: rashmi             
Posted Date: May 25, 2011     Points: 20   

hi sunil
thanks,but i want to retrieve image from db in C# windows application
can u help me

Author: Gowthammanju             
Posted Date: May 25, 2011     Points: 20   


look at the project attached on this

kindly note change the database string connection on this and attach to ur local database

Download Attachment

Thanks & Regards,

Mark if the answer is true
Author: Aamrapali Tamgadge             
Posted Date: June 01, 2011     Points: 20   

SqlCommand cmd = new SqlCommand("Select myimage from image where id=26", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds, "image");
int c = ds.Tables["image"].Rows.Count;
if (c > 0)
Byte[] img = new Byte[0];
img = (Byte[])(ds.Tables["image"].Rows[c - 1]["myimage"]);
MemoryStream aashu = new MemoryStream(img);
pictureBox1.Image = Image.FromStream(aashu);

Software Programmer At OTIS ISRC

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend