Eccomi.. ho provato ed eseguire questo codice.. ma sicuramente sbaglio nell'ottenere il valore bt dall'array buffer...il campo bin, nel database mysql è un campo BLOB
sapete dirmi come si fa??
Codice PHP:
imageIn.Image = Image.FromFile(openFileDialog1.FileName);
Image img = Image.FromFile(openFileDialog1.FileName);
MemoryStream ms = new MemoryStream();
img.Save(ms, img.RawFormat);
Byte[] buffer = new Byte[ms.Length - 1];
ms.Position = 0;
ms.Read(buffer, 0, buffer.Length);
byte bt = Convert.ToByte(buffer);
MySQLConnection conn = new MySQLConnection("Location=localhost;User ID=root;Password=######;Data Source=test;Port=3306");
MySQLCommand cmd = new MySQLCommand("INSERT INTO img (bin) VALUES(" + bt + ")", conn);
try
{
conn.Open();
cmd.ExecuteNonQuery();
MessageBox.Show("Dati inseriti correttamente");
}
catch (Exception g)
{
MessageBox.Show("Errore : " + g + "");
}