Solved

retrieve sql image data type into asp.net display

Posted on 2011-02-25
4
927 Views
Last Modified: 2012-05-11
I need to retrieve a image field from a sql database into some to display it in my asp.net app..

any suggestions on how to do this?
0
Comment
Question by:vbnetcoder
  • 2
4 Comments
 
LVL 13

Expert Comment

by:agarwalrahul
Comment Utility

http://www.codeproject.com/KB/database/ImageSaveInDataBase.aspx
http://social.msdn.microsoft.com/Forums/en/adodotnetdataproviders/thread/deb976d4-0678-4411-8e76-be2a7f5f280b

Example:
// imageData retrieve from SQL Server
                byte[] imageData = GetBytesFromUrl("http://student.kfupm.edu.sa/s200354630/Multi/images/o-png8.png");
                MemoryStream stream = new MemoryStream(imageData);

                System.Drawing.Image img = System.Drawing.Image.FromStream(stream);

                Response.Clear();
                Response.ContentType = "image/jpg";
                img.Save(Response.OutputStream, ImageFormat.Jpeg);
                img.Dispose();
0
 

Author Comment

by:vbnetcoder
Comment Utility
I used the code in the first link and it did not like this line:

 pictureBox1.Image = Image.FromFile(strfn)

it said that .fromfile was not a member of system.web.ui.webcontrols.image
0
 
LVL 2

Accepted Solution

by:
aspxkid earned 500 total points
Comment Utility
0
 

Author Closing Comment

by:vbnetcoder
Comment Utility
ty
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now