title: Save C# Image to SQLyog Database
body: <p>I wanna save a picture from pictureBox1 and save it to my database in SQLyog. I have used a lot of codes but none seems to work for me. The data type that I'm using in my database is LONGBLOB.</p>
  
  <p>Example is:</p>
  
  <pre><code>MemoryStream ms = new MemoryStream();
  pictureBox1.Image.Save(ms, ImageFormat.Jpeg);
  byte[] PhotoByte = ms.ToArray();
  
  //sql string
  _sSQL = "INSERT INTO student_pictures (Picture)" +
          " VALUES (" + Photobyte + ")";
  
  DBConnection sSQL = _sSQL;
  </code></pre>