📅  最后修改于: 2022-03-11 14:56:15.380000             🧑  作者: Mango
byte[] imageBt = null;
FileStream fstream = new FileStream(this.txtImage.Text, FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fstream);
imageBt = br.ReadBytes((int)fstream.Length);
conn.Open();
MySqlCommand command = new MySqlCommand("insert into images(image)values(@IMG)", conn);
command.Parameters.Add(new MySqlParameter("@IMG", imageBt));
reader = command.ExecuteReader();
MessageBox.Show("Saved");
while (reader.Read())
{
}