title: How to save and Retrive PictureBox Image to Sql Server Database Varbinary(Max) Column VB.NET
body: <p>In my windows application I have to display image in Windows Form PictureBox which will be browsed by OpenFile Dialog, and then save PictureBox image to Sql Server 2008 R2 Varbinary(Max) Column and Show Picture saved in Sql Server 2008 R2 Varbinary(Max) column to PictureBox Using VB.NET 2010.</p>
  
  <p>I have used the following code to load Picture from physical drive to PictureBox</p>
  
  <pre><code>    Private Sub btnPicBrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPicBrowse.Click
      With Me.OpenFileDialog1
          .FileName = ""
          .Filter = "Image Files(*.BMP;*.JPG;*.JEPG;*.GIF)|*.BMP;*.JPG;*.JEPG;*.GIF|All files (*.*)|*.*"
          .RestoreDirectory = True
          .ValidateNames = True
          .CheckFileExists = True
          If .ShowDialog = Windows.Forms.DialogResult.OK Then
              Me.PictureBox1.Image.Dispose()
              Me.PictureBox1.Image = System.Drawing.Image.FromFile(.FileName)
              Me.lblPicPath.Text = .FileName
          End If
      End With
  End Sub
  </code></pre>
  
  <p>Now I have to save this Image to SQL SERVER 2008 Database VarBinary (MAX) Column and Then Show Picture saved in Sql Server 2008 R2 Varbinary(Max) column to PictureBox Using VB.NET 2010.</p>
  
  <p>Thanks &amp; Regards</p>
  
  <p>JYOTIRMOY</p>