title: Getting a picture from MS Access in to a picturebox in C#
body: <p>Hi  I have used the code below to save  images to my database,</p>
  
  <p>but now I want to know how I can get the picture from the database to a PictureBox</p>
  
  <p>can you please help me.</p>
  
  <pre><code>private void button1_Click(object sender, EventArgs e)
  {
      ofdFoto.ShowDialog();
      string i = ofdFoto.FileName.ToString();
      pbxFoto.ImageLocation = i;
  }
  
  private void button2_Click(object sender, EventArgs e)
  {
      dbConn.Open();
      string querys = "INSERT INTO Fruits (Name, Picture) VALUES ('" + txtName.Text + "','" + ImageToByte(pbxFoto.Image) + "')";
      OleDbCommand cd = new OleDbCommand(querys, dbConn);
      cd.ExecuteNonQuery();
      dbConn.Close();
      MessageBox.Show("Picture saved", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
  }
  
  public static byte[] ImageToByte(Image img)
  {
      ImageConverter converter = new ImageConverter();
      return (byte[])converter.ConvertTo(img, typeof(byte[]));
  }
  </code></pre>