Private Sub ImageDisplay() Try PictureBox1.Image = Nothing Dim Scon As New SqlConnection("Data Source=xxx; Initial Catalog=xxx; Trusted_Connection=True; timeout = 100") Scon.Open() Dim Scom As New SqlCommand("Select datafrom table1 where id=2", Scon) 'to be updated Try Dim imageData As Byte() = DirectCast(Scom.ExecuteScalar(), Byte()) If Not imageData Is Nothing Then Using ms As New MemoryStream(imageData, 0, imageData.Length) ms.Write(imageData, 0, imageData.Length) newImage = Image.FromStream(ms, True) End Using PictureBox1.Image = newImage End If Catch ex As Exception MessageBox.Show(ex.Message) End Try Scon.Close() Catch ex As Exception Finally End Try End Sub
Dim Scom As New SqlCommand("Select datafrom table1 where id=2", Scon) 'to be updated
Dim Scom As New SqlCommand("Select data from table1 where id=2", Scon) 'to be updated
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)