title: How To Retrieve LONGBLOB from MySQL in C# without datatype size but only datatype longblob
body: <p>hello guys i want to retrieve LONGBLOB from MySQL in C#  without datatype size but only datatype longblob.i can save in mysql use longblob but i can retrieve it again.</p>
  
  <p>I have created a table named 'dataalis' in that,</p>
  
  <pre><code>CREATE TABLE  `Wajah`.`dataalis` (
  `No` int(10) unsigned NOT NULL auto_increment,
  `Nama` varchar(45) default NULL,
  `Keterangan` varchar(600) default NULL,
  `Gambar` longblob,
  PRIMARY KEY  (`No`)
  ) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8;
  </code></pre>
  
  <p>And</p>
  
  <pre><code>nama = namatxt.Text;
              keterangan = keterangantxt.Text;
              db = new DBConnect();
              FileStream fs = new FileStream(location, FileMode.Open, FileAccess.Read);
              int fileLength = (int)fs.Length;
              byte[] rawdata = new byte[fileLength];
              fs.Read(rawdata, 0, (int)fileLength);
              MySqlCommand cmd = new MySqlCommand();
              String sql = "insert into dataalis (Nama,Keterangan,Gambar) values(@Nama,@Keterangan,@Gambar)";
              cmd.Connection = db.getConnection();
              cmd.CommandText = sql;
              cmd.Parameters.AddWithValue("@Nama", nama);
              cmd.Parameters.AddWithValue("@Keterangan", keterangan);
              cmd.Parameters.AddWithValue("@Gambar", rawdata);
              int result = cmd.ExecuteNonQuery();
              fs.Close();
              MessageBox.Show("Data Tersimpan","Peringatan");
  </code></pre>
  
  <p>to save image to mysql</p>
  
  <p>and i have try to retrieve longblob image use this code</p>
  
  <pre><code>MySqlCommand cmd = new MySqlCommand();
              cmd.Connection = db.getConnection();
              cmd.CommandText = "select * from datamulut";
              data = cmd.ExecuteReader();
              while (data.Read())
              {
                  int fileSize = data.GetInt32(data.GetOrdinal("size"));
                  string name = data.GetString(data.GetOrdinal("Keterangan"));
                  byte[] rawData = new byte[fileSize];
                  data.GetBytes(data.GetOrdinal("Gambar"), 0, rawData, 0, fileSize);
                  MemoryStream ms = new MemoryStream(rawData);
                  images.Add(Image.FromStream(ms));
                  gambar1.Image = images[0];
                  hasil1txt.Text = (name);
              }
              data.Close();
  </code></pre>
  
  <p>in that code i not use a filesize data only longblob.how i can retrieve image without filezie only longblob data?</p>