Dim val As Integer
Dim cmd As New SQLCommand
cmd.C
cmd.CommandText = "Se lect top 1 ImageBinary From {SDBC_Sa} Where BarcodeData ='" & e.Form.Controls("TextBox1").Text & "'and DATALENGTH(ImageBinary) > 0 order by resend,Date2 desc"
Dim dt As DataTable = cmd.ExecuteReader
If dt.datarows.count > 0 Then
Dim imagebytes As Byte() = dt.DataRows(0)("ImageBinary")
Dim stream As System.IO.Stream = New System.IO.MemoryStream(imagebytes)
Dim bmp As System.Drawing.Bitmap = New System.Drawing.Bitmap(stream)
Dim pbx As WinForm.PictureBox = Forms("pic").Controls("PictureBox1")
pbx.Image = bmp
End If