Codingitup
asked on
How to retieve image from sql server asp.net c#
Hi All,
I've got a sql table called ImageTest that has a column called ImageData. I use the following stored procedure to return this data as follows: -
How do I set my imagebox imgPreview1 to display this image returned from the sql procedure please?
Many Thanks
Lee
I've got a sql table called ImageTest that has a column called ImageData. I use the following stored procedure to return this data as follows: -
SqlCommand cmd2 = new SqlCommand("web.Get_Image", myConn);
SqlDataReader dr2 = null;
cmd2.CommandType = CommandType.StoredProcedure;
cmd2.Parameters.Add(new SqlParameter("@ImgID", cmbLoggedPartno.Text));
SqlParameter parm = new SqlParameter("@Image", SqlDbType.Image);
parm.Direction = ParameterDirection.Output; // This is important!
cmd2.Parameters.Add(parm);
dr2 = cmd2.ExecuteReader();
How do I set my imagebox imgPreview1 to display this image returned from the sql procedure please?
Many Thanks
Lee
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Sorry I'm new to this coding. I've tried part of the example as: -
Open in new window
But can't understand how to set the imagebox to display it.
Many Thanks
Lee