Hi
First download and save that picture in temp folder from sql based on select query and in picture box imagelocation url u give that temp folder path with picture name.
PictureBox1.ImageLocation = "C:\inetpub\wwwroot\ccp\temp\a.ico"
I think u store ur picture stored in binary format in sql.
Dim cn As New SqlConnection()
cn.ConnectionString = "Data Source=.;uid=sa;pwd=wintellect;database=master"
cn.Open()
Dim sql As String = "Select * from student where rollno=" + comboBox1.SelectedItem
Dim cmd As New SqlCommand(sql, cn)
Dim dr As SqlDataReader = cmd.ExecuteReader()
If dr.HasRows Then
dr.Read()
Dim data As Byte() = DirectCast(dr("MemPhoto"), Byte())
Dim ms As New MemoryStream(data)
pictureBox1.Image = Image.FromStream(ms)
End If
cn.Close()
U have modify connection string and select query based on ur requirements
-----------------------------------------------------------------------
Dim cmd As New SqlCommand("Select MemPhoto from FamilyDetails where FamilyID=@FamilyID", sqlcon)
cmd.Parameters.Add("@FamilyID", SqlDbType.Int).Value = txtsearchbox.Text
Dim dt As New DataTable
Dim adp As New SqlDataAdapter(cmd)
adp.Fill(dt)
If dt.Rows(0)("").ToString IsNot Nothing Then
Dim data1 As Byte() = DirectCast(dt.Rows(0)(""), Byte())
Dim ms As New MemoryStream(data1)
PictureBox1.Image = Image.FromStream(ms)
ms.Close()
End If
If dt.Rows(1)("").ToString IsNot Nothing Then
Dim data2 As Byte() = DirectCast(dt.Rows(0)(""), Byte())
Dim ms As New MemoryStream(data2)
PictureBox2.Image = Image.FromStream(ms)
ms.Close()
End If
If dt.Rows(2)("").ToString IsNot Nothing Then
Dim data3 As Byte() = DirectCast(dt.Rows(0)(""), Byte())
Dim ms As New MemoryStream(data3)
PictureBox3.Image = Image.FromStream(ms)
ms.Close()
End If
................................................upto seven picturebox
In above code like hard coded,i mean, we know 7 photo and 7 picturebox in form,so without looping i will bind photo in each picturebox using dt.Rows(0)("") to PictureBox1,dt.Rows(1)("") to PictureBox2 and so on.so at lest u change this part by looping .