Hey I am havin some trouble loading an image from my sql db into a image on my form....
Using this code I got from the codebank:
vb Code:
Dim connection As New SqlConnection("blahblah") Dim command As New SqlCommand("SELECT ImageData FROM Style_Images WHERE ImageID = 1", connection) connection.Open() Dim pictureData As Byte() = DirectCast(command.ExecuteScalar(), Byte()) connection.Close() Dim picture As Image = Nothing Using stream As New IO.MemoryStream(pictureData) picture = Image.FromStream(stream) End Using
When I try to assign picture to my Image control I get this message in the error list:
Value of type 'System.Drawing.Image' cannot be converted to 'System.Web.UI.WebControls.Image'
Am I completely off on the way to to do this?




Reply With Quote