public static int ExecuteSqlInsertImg(string strSQL, byte[] fs)
  {
  using (MySqlConnection connection = new MySqlConnection(DBconnection.StrConnection))
  {
  MySqlCommand cmd = new MySqlCommand(strSQL, connection);  
  cmd.CommandType = CommandType.Text;
  cmd.Parameters.Add(new MySqlParameter("?fs", MySqlDbType.LongBlob, fs.Length)).Value = fs;
  try
  {
  if (connection.State == ConnectionState.Closed)
  connection.Open();
  int rows = cmd.ExecuteNonQuery();
  return rows;
  }
  catch (MySqlException e)
  {
  ilog.Error(e);
  }
  finally
  {
  cmd.Dispose();
  connection.Close();
  }
  return 0;
  }
  }执行方法:
System.IO.FileStream buffer = new System.IO.FileStream(bwtLogoPath.Text, System.IO.FileMode.Open, System.IO.FileAccess.Read);
  System.IO.BinaryReader br = new System.IO.BinaryReader(buffer);
  byte[] image = br.ReadBytes((int)buffer.Length);  ExecuteSqlInsertImg("update cmyinfo set `LogoImage`=?fs", image);