Solved

Control to load a JPG file - Binary stream

Posted on 2004-03-29
6
292 Views
Last Modified: 2008-02-01
Hi,

is there any control which can load a jpg file by passing the Binary stream.


pls let me know asap.
thanks.
0
Comment
Question by:chandua
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
6 Comments
 
LVL 22

Expert Comment

by:_TAD_
ID: 10709467


No, but you can load an image object from a stream and then drop that Image onto a picturebox.


it will look something like this:

picturebox1.Image = Image.FromStream(myBinaryStream);
0
 

Author Comment

by:chandua
ID: 10716766
hi TAD,

i am creating a Webpart (SPS 2003), i cant have a picture box in it.
0
 

Author Comment

by:chandua
ID: 10717036
hi TAD,

i am trying to get the stream from database
string sqlText = "SELECT img_data FROM Image WHERE img_pk = " + ImageId;
SqlConnection connection = new SqlConnection( ConfigurationSettings.AppSettings["DSN"].ToString() );
SqlCommand command = new SqlCommand( sqlText, connection);
 //open the database and get a datareader
connection.Open();
SqlDataReader dr = command.ExecuteReader();
if ( dr.Read()) //found image
{
 pictureBox1.Image=Image.FromStream((byte[]) dr["img_data"]);
}
i cant pass the dr["img_data"].. how do i convert to straeam/
0
 
LVL 22

Accepted Solution

by:
_TAD_ earned 200 total points
ID: 10719662


Create a Memory Stream.


MemoryStream memStr = new MemoryStream(myByteArray);
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

623 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