retrieving images from sql database

  • Thread starter Thread starter ahmeddc
  • Start date Start date
A

ahmeddc

Guest
I have a hosted database sql server 2014
It has only 3 rows and each row has a cell of images .

cell image number 2


I want to retrievethe three row in database images to a program with three PictureBox

at the same time
The current method was used to retrieve only one image
What is the best way to retriev 3images from a database to 3 PictureBox


code retrieveonly one image

Try
conns.Open()
Using table As DataTable = New DataTable
Using command As SqlCommand = New SqlCommand("SELECT IMAGEA from IMAGE_TBA where id=" & textid.Text, conns)
Using adapter As SqlDataAdapter = New SqlDataAdapter(command)
adapter.Fill(table)
End Using
End Using
For Each row As DataRow In table.Rows
Dim lb() As Byte = row("IMAGEA")
Dim lstr As New System.IO.MemoryStream(lb)
PictureBox1.Image = Image.FromStream(lstr)
PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
Next
End Using
conns.Close()
Catch ex As Exception

End Try

Continue reading...
 
Back
Top