Results 1 to 7 of 7
  1. #1
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Brisbane, Queensland, Australia
    Posts
    387
    Thanks
    0
    Thanked 1 Time in 1 Post

    Display Images from SQL Server (XP\SQL Express 200

    I have a SQL database with images stored as binary data. I am attempting to display then in a bound object frame but they don't display. I can add images via the form and these work OK. The client swears that there are images in the records they created (though not via Access). Any suggestions as what to look for?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Display Images from SQL Server (XP\SQL Express 200

    The images are probably stored as BLOBs. You can extract the contents to a temporary file and display this. See:
    How To Read and Write BLOBs Using GetChunk and AppendChunk
    Imaging Examples
    There are (commercial) third-party controls that make it easier to work with BLOB data, for example DBPix; you can download a free evaluation copy.

  3. #3
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Brisbane, Queensland, Australia
    Posts
    387
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Display Images from SQL Server (XP\SQL Express

    Post deleted by kentg

  4. #4
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Brisbane, Queensland, Australia
    Posts
    387
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Display Images from SQL Server (XP\SQL Express

    in ADO 2.5 the stream object came into being and it's much easier than getchunk. here is an example and it works just great.
    Dim cn As ADODB.Connection, rs As ADODB.Recordset, SQL As String
    Dim stmPhoto As New ADODB.Stream
    stmPhoto.Type = adTypeBinary

    Set cn = New ADODB.Connection
    Set rs = New ADODB.Recordset
    cn.CursorLocation = adUseServer
    cn.Open "dsn=TafeTasmania"

    SQL = "SELECT * FROM Student WHERE Student_ID = " & 1002
    rs.Open SQL, cn, adOpenStatic, adLockReadOnly
    stmPhoto.Open
    stmPhoto.Write rs!Student_Photo
    stmPhoto.SaveToFile "C:Student_Photo77.JPG", adSaveCreateOverWrite
    stmPhoto.Close
    rs.Close
    cn.Close

  5. #5
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Brisbane, Queensland, Australia
    Posts
    387
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Display Images from SQL Server (XP\SQL Express

    Problem now is, and I think it has something to do with ADO 2.5, i cannot get rs.edit to work, "Method or data member not found" I also tried .editMode from the list and I get "Invalid use of Property

    SQL = "SELECT * FROM Student WHERE Student_ID = " & 1002
    rs.Open SQL, cn, adOpenDynamic, adLockOptimistic

    rs.Edit

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Display Images from SQL Server (XP\SQL Express

    By deleting the text of a post, then posting a reply to the empty post, you've made the thread hard to follow. Please don't do that.

  7. #7
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Brisbane, Queensland, Australia
    Posts
    387
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Display Images from SQL Server (XP\SQL Express

    oops sorry

Posting Permissions

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