title: Display Image from SQL Server image datatype in vb.net
body: <p>Please help. I'm trying to display images to the program I made.. but I did not have to insert it. Another system is inserting the picture, so I'm not sure how they insert it. I just can access the SQL Server data. So now I try to retrieve the image and display it in DatagridView, but I always get this error:</p>
  
  <p>Image is error</p>
  
  <p><a href="https://i.stack.imgur.com/00HDX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/00HDX.png" alt=""></a></p>
  
  <p>Error</p>
  
  <p><a href="https://i.stack.imgur.com/Ro3c6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ro3c6.png" alt=""></a></p>
  
  <p>This is what the database look like.. datatype : image</p>
  
  <p><a href="https://i.stack.imgur.com/5vzMP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5vzMP.png" alt="enter image description here"></a></p>
  
  <p>And this is my code. Please help me.</p>
  
  <pre><code> Dim cmd As SqlCommand = New SqlCommand(" select * from iUserPicture ", Connection)
  
      cmd.Connection = Connection
      Dim adapter As New SqlDataAdapter(cmd)
      Dim table As New DataTable()
      adapter.Fill(table)
      DataGridView1.DataSource = table
      DataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnMode.Fill
      DataGridView1.RowTemplate.Height = 100
  
      Dim imgc As New DataGridViewImageColumn()
      imgc = DataGridView1.Columns(1)
      imgc.ImageLayout = DataGridViewImageCellLayout.Stretch
  </code></pre>