Solved

retrieve sql image data type into asp.net display

Posted on 2011-02-25
4
931 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
ID: 34985545

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
ID: 34985632
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
ID: 34987503
0
 

Author Closing Comment

by:vbnetcoder
ID: 34987622
ty
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Question about JQuery and asp.net 3 31
Object Oriented Programming, C#, referencing, scoping. 13 69
VB.Net. Reading xml value 6 30
Running powershell scripts from ASP.NET 6 31
Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

829 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