title: VB.NET: Retrive an image (blob) from MySQL DB
body: <p>I've a field called "Foto" in MySQL DB. This field is a blob. When I used SQL Server, the following code worked:</p>
  
  <pre><code>    Dim conn As New MySqlConnection
      conn.ConnectionString = ConnectionString
      Dim cmd As New MySqlCommand
      cmd.Connection = conn
      conn.Open()
      cmd.CommandText = "SELECT Foto FROM MyTable WHERE ID = '" &amp; IDtxt.ToString &amp; "'"
      Dim reader As MySqlDataReader
  
          reader = cmd.ExecuteReader
          While reader.Read
              If (IsDBNull(reader("Foto"))) Then
                  frmCartaIdentitaView.pctImage.Image = Nothing
              Else
                  Dim byteImage() As Byte = reader("Foto")
                  Dim frmImageView stmFoto As New System.IO.MemoryStream(byteImage)
                  frmImageView.pctImage.Image = Image.FromStream(stmFoto)
                  frmImageView.pctImage.SizeMode = PictureBoxSizeMode.Zoom
                  frmImageView.Show()
              End If
          End While
  </code></pre>
  
  <p>But now that I'm using mysql, is produced the following error: invalid parameter.</p>