title: Retrieve Long Binary Data (Image) from Access using VB.NET
body: <p>My code is</p>
  
  <pre><code>Dim con As New OleDb.OleDbConnection
      Dim dbProvider As String
      Dim dbSource As String
  
      dbProvider = "PROVIDER=Microsoft.Jet.OLEDB.4.0;"
      dbSource = "Data Source=" &amp; My.Settings.bowlingballdatabase
  
  
  
      Dim selectString As String = "Select Picture From BowlingBall WHERE LName = 'Smith'"
      Dim oleConnect As New OleDb.OleDbConnection
      oleConnect.ConnectionString = dbProvider &amp; dbSource
      oleConnect.Open()
      Using oleDBCmd As OleDb.OleDbCommand = oleConnect.CreateCommand()
          oleDBCmd.CommandType = CommandType.Text
          oleDBCmd.CommandText = selectString
          Using oleDbReader As OleDb.OleDbDataReader = oleDBCmd.ExecuteReader()
              oleDbReader.Read()
              Dim ImageBytes As Byte() = CType(oleDbReader(0), Byte())
              Dim ms As New MemoryStream(ImageBytes)
              Dim img As Image = Image.FromStream(ms)
              Me.PictureBox1.Image = img
          End Using
      End Using
      oleConnect.Close()
  </code></pre>
  
  <p>I think its a problem with the SQL commands maybe? I get the error "Parameter is not valid" on the following line:</p>
  
  <pre><code>Dim img As Image = Image.FromStream(ms)
  </code></pre>