Saving and retrieving image from SQL Server database

Discussion in 'Programming General' started by WalangAlam, May 15, 2007.

Saving and retrieving image from SQL Server database
  1. Unread #1 - May 15, 2007 at 1:46 AM
  2. WalangAlam
    Referrals:
    0

    WalangAlam Guest

    Saving and retrieving image from SQL Server database

    How to Save and retrieve image from SQL Server Express 2005 database using VB.Net?
     
  3. Unread #2 - May 15, 2007 at 8:33 AM
  4. dodge
    Joined:
    Mar 26, 2007
    Posts:
    125
    Referrals:
    1
    Sythe Gold:
    5

    dodge Active Member
    Banned

    Saving and retrieving image from SQL Server database

    Code:
      Dim sQuery As New System.Text.StringBuilder()
      Dim oDataTable As New DataTable()
      Dim dtRow As DataRow
      Dim imagedata() As Byte
      Dim imageBytedata As MemoryStream
      sQuery.Append("SELECT image FROM images WHERE imageId = " & _
                    cmbImgIds.SelectedItem)
      oDataTable = New Connection().doDBconnection(sQuery.ToString, "Image")
     
      For Each dtRow In oDataTable.Rows
        imagedata = dtRow.Item("image")
        imageBytedata = New MemoryStream(imagedata)
      Next
      picBox.Image = Image.FromStream(imageBytedata)
    
     
< Binding Combobox to a dataset | automatically add - to a multiline textbox >

Users viewing this thread
1 guest


 
 
Adblock breaks this site