Please I need help here. I am using data from a gridview to fill textboxes and a pictureBox. The textboxes fill up just fine when I click on a row. But the picture box shows just one image. irrestpective of which row I select the same image shows up. Please I am new to c# and I need help. Here is what I have done so far private void viewMemberGrid_CellClick(object sender, DataGridViewCellEventArgs e) {
DataGridViewRow dr = viewMemberGrid.SelectedRows[0];
GmemIDBox.Text = dr.Cells[0].Value.ToString();
GsurnameBox.Text = dr.Cells[1].Value.ToString();
GfirstnameBox.Text = dr.Cells[2].Value.ToString();
GphoneBox.Text = dr.Cells[3].Value.ToString();
memDeptBox.Text = dr.Cells[7].Value.ToString();
memPortBox.Text = dr.Cells[8].Value.ToString();
GaddBox.Text = dr.Cells[5].Value.ToString();
GdobBox.Text = dr.Cells[6].Value.ToString();
string select = "Select NEWMEMBER.MemberID, Surname, Firstname, PhoneNumber, MemberPic, HomeAddress,DOB,DeptID,PortfolioDesc from NEWMEMBER inner join Pictures on NEWMEMBER.MemberID = Pictures.MemberID join PortfolioDescription on PortfolioDescription.PortfolioId = NEWMEMBER.PortfolioID";
SqlConnection c = new SqlConnection("Data Source=.;Initial Catalog=Cmanager;Integrated Security=True");
SqlCommand cmd = new SqlCommand(select, c);
try
{
c.Open();
SqlDataReader dro = cmd.ExecuteReader();
if (dro.Read())
{
byte[] picarr = (byte[])dro["MemberPic"];
MemoryStream ms = new MemoryStream(picarr);
ms.Seek(0, SeekOrigin.Begin);
memPicBox.Image = Image.FromStream(ms);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
c.Close();
}