Results 1 to 5 of 5

Thread: How to save an imagem, from a PictureBox, to a database? (RESOLVED)

  1. #1

    Thread Starter
    Addicted Member AlvaroF1's Avatar
    Join Date
    Sep 2002
    Location
    SP - Brazil
    Posts
    200

    Question How to save an imagem, from a PictureBox, to a database? (RESOLVED)

    How to save an image, from a PictureBox, to an Access database using OleDb?

    How to load an image from this database to a PictureBox?


    Thanks.
    Last edited by AlvaroF1; Oct 23rd, 2003 at 12:21 PM.

  2. #2
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    Dublin (Ireland)
    Posts
    304
    Not an answer but as a pointer start looking at stream,which can both read and write and is the way of moving images around from one place to another in .net

    a stream can both read and write and certainly have used them to load images so can see no reason why they can't be used the other way

  3. #3
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    Dublin (Ireland)
    Posts
    304
    Not an answer but as a pointer start looking at stream,which can both read and write and is the way of moving images around from one place to another in .net

    a stream can both read and write and certainly have used them to load images so can see no reason why they can't be used the other way

  4. #4
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    This was just asked and answered a week ago and is on the next page of topics. you should try searching before you ask it might save you the time of waiting for an answer.

    This example uses SQL I think but will work the same with OLEDB.
    http://www.vbforums.com/showthread.p...hreadid=263522

  5. #5
    New Member
    Join Date
    Oct 2003
    Location
    Valenzuela City, Philippines
    Posts
    9

    Talking

    I think you should try to look at this example.
    ---------------------------------------------------------


    Public Function GetPicture(ByRef LoadedImage As String) As Boolean
    On Error GoTo ErrHndlr
    With rsEmployee
    If IsNull(.Fields("PICT_IMAGE").Value) Then
    GetPicture = False
    Exit Function
    End If
    Set strStream = New ADODB.Stream
    strStream.Type = adTypeBinary
    strStream.Open
    strStream.Write .Fields("PICT_IMAGE").Value

    strStream.SaveToFile "C:\Temp.bmp", adSaveCreateOverWrite
    LoadedImage = "C:\Temp.bmp"
    GetPicture = True
    End With
    End Function

    Public Function UpdatePicture(ByVal ImageFilename As String) As Boolean
    On Error GoTo ErrHndlr
    Dim Image2Save As StdPicture
    With rsEmployee
    Set strStream = New ADODB.Stream
    strStream.Type = adTypeBinary
    strStream.Open
    strStream.LoadFromFile ImageFilename
    .Fields("PICT_IMAGE").Value = strStream.Read
    UpdatePicture = True
    End With
    End Function


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width