pictureBox1.Image =this.byteArrayToImage((byte[])c.dr[2]);
public Image byteArrayToImage(byte[] byteArrayIn) { MemoryStream ms = new MemoryStream(byteArrayIn); Image returnImage = Image.FromStream(ms); return returnImage; }
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionstring chaine = "Server=Caleb-PC;user id=sa;pwd=projets;database=Essai_Gis";
SqlConnection cnn = new SqlConnection(chaine);
SqlCommand cmd = new SqlCommand("Select photo from Point where nom=1", cnn);
SqlDataReader Dtread;
cnn.Open();
Dtread = cmd.ExecuteReader();
while(Dtread.Read())
{
System.Drawing.Image image = System.Drawing.Image.FromStream( new System.IO.MemoryStream( (byte[])Dtread["photo"] ) );
pictureBox2.Image = image;
}
cnn.Dispose();
cnn.Close();