hi everyone. I have this code to retrieve image from sql server using asp.net with vb, the problem is the image cannot display in the web page and I don't know what is the problem can you please help me.`
Imports System.Data.SqlClient
Imports System.IO
Imports System.Drawing
Public Class _Default
Inherits System.Web.UI.Page
Public sqlcon As SqlConnection = New SqlConnection("server=.; database=batool; Trusted_Connection=yes;")
Public sqlcmd As SqlCommand
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
Try
sqlcon.Open()
sqlcmd = New SqlCommand("select photo from qq", sqlcon)
Dim reader As SqlDataReader = sqlcmd.ExecuteReader
If reader.Read Then
Context.Response.BinaryWrite(DirectCast(reader("photo"), Byte()))
End If
sqlcon.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Class
`