title: How to insert BLOB datatype
body: <p>I'm using the following code to insert into a blob field:</p>
  
  <hr>
  
  <pre><code>MySql.Data.MySqlClient.MySqlConnection conn;
  MySql.Data.MySqlClient.MySqlCommand cmd;
  
  conn = new MySql.Data.MySqlClient.MySqlConnection();
  cmd = new MySql.Data.MySqlClient.MySqlCommand();
  
  string SQL;
  int FileSize;
  byte[] rawData;
  FileStream fs;
  
  conn.ConnectionString = "server=192.168.1.104;uid=root;" +
          "pwd=root;database=cady234;";
  
  fs = new FileStream(@"d:\Untitled.gif", FileMode.Open, FileAccess.Read);
  FileSize = (int)fs.Length;
  
  rawData = new byte[FileSize];
  fs.Read(rawData, 0, FileSize);
  fs.Close();
  
  conn.Open();
  
  string strFileName = "test name";
  SQL = "INSERT INTO file (file_name, file_size, file) VALUES ('" + strFileName + "', "+FileSize+", '"+rawData+"')";
  
  cmd.Connection = conn;
  cmd.CommandText = SQL;
  
  cmd.ExecuteNonQuery();
  conn.Close();
  </code></pre>
  
  <hr>
  
  <p>The insertion is ok but the image is not getting displayed while using "Open value in viewer":</p>
  
  <p><img src="https://i.stack.imgur.com/Ul8hO.png" alt="enter image description here"></p>