I don't recall the details of this - as I did it a couple of years ago - but the thread I posted a link to shows this code
Code:Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim dcn As New SqlConnection dcn.ConnectionString = "Server=fps-lap-sz\sqlexpress; Initial Catalog=Stufiles; Integrated Security=SSPI" Try dcn.Open() Dim drc As New SqlCommand drc.Connection = dcn drc.CommandType = Data.CommandType.StoredProcedure drc.CommandText = "GetStuPhoto_P" drc.Parameters.Add(New SqlParameter("@StuId", Data.SqlDbType.VarChar, 255, Data.ParameterDirection.Input _ , False, 0, 0, "", Data.DataRowVersion.Default, Request.QueryString("imageid"))) Dim bytArrayContent As Byte() = DirectCast(drc.ExecuteScalar, Byte()) 'bytArrayContent = CType(dr.Item("ImageField"), Byte()) Response.ContentType = "image/jpeg" Response.OutputStream.Write(bytArrayContent, 0, bytArrayContent.Length) Response.End() txtMessage.Text = "Student Displayed!" Catch ex As Exception txtMessage.Text = "Student Not Found!" End Try




Reply With Quote