kyleolson Posted December 23, 2008 Posted December 23, 2008 What am I doing wrong????? :confused: Dim oSQLConn As SqlConnection = New SqlConnection() Dim dr As SqlDataReader oSQLConn.ConnectionString = ConnString Dim strSQL As String 'Get Items.. strSQL = "SELECT object FROM images where type = 'logo2'" oSQLConn.Open() Dim cmd As New SqlCommand(strSQL, oSQLConn) dr = cmd.ExecuteReader dr.Read() picLogo.Image = Nothing 'MsgBox(dr.Item("type")) Dim bytImageData() As Byte = dr.Item("object") Dim stmImageData As New MemoryStream(bytImageData) picLogo.Image = Image.FromStream(stmImageData) Quote
Administrators PlausiblyDamp Posted December 26, 2008 Administrators Posted December 26, 2008 Are you getting any errors when you are using the above code or is it just not displaying the image? If you step through the code does bytImageData get assigned anything on the line Dim bytImageData() As Byte = dr.Item("object") Have you tried the GetSqlBytes method of the SqlDataReader? This exposes a Stream property you can use directly without needing to copy data into a bytre array etc. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.