Torna al Thread
private void button2_Click(object sender, EventArgs e)
{
MySQLConnection DBConn;
DBConn = new MySQLConnection(new MySQLConnectionString("localhost", "CONSIGLIO", "root", "password").AsString);
DBConn.Open();
MySQLCommand cmd = new MySQLCommand("select IMAGE from IMMAGINI where ID = 1", DBConn); // query di prova
MySQLDataReader reader = null;
reader = cmd.ExecuteReaderEx(); //ExecuteReader();
reader.Read();
byte[] dati=(byte[])reader.GetValue(0);
reader.Close();
//dati = (byte[])dt.Rows[0]["IMAGE"];
//Crea un MemoryStream partendo dal nostro Buffer dati
MemoryStream ms = new MemoryStream(dati, 0, dati.Length);
//Crea un'immagine usando come sorgente il MemoryStream
Image i = Image.FromStream(ms);
//Rappresenta l'immagine sulla PictureBox
pictureBox1.Image = i;
}