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; }
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5