CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2014
    Posts
    7

    How to insert and read image from database (sql server) using MFC ?

    How to insert and read images to/from database (sql server) using MFC ?
    an example or a reference would be appreciated

  2. #2
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,607

    Re: How to insert and read image from database (sql server) using MFC ?

    Any image is just a number of bytes from database standpoint. So, to store images, your database column must be of some binary type, the size enough to store any possible image size.

    Using CLongBinary for BLOBs
    Best regards,
    Igor

  3. #3
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,095

    Re: How to insert and read image from database (sql server) using MFC ?

    Or use the CByteArray class...
    Victor Nijegorodov

  4. #4
    Join Date
    Dec 2014
    Posts
    7

    Re: How to insert and read image from database (sql server) using MFC ?

    Thanks for the reply .
    I did use Image , Istreams, and bytes class.
    This source helped a lot .
    http://www.codeproject.com/Articles/...y-show-picture

  5. #5
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,624

    Re: How to insert and read image from database (sql server) using MFC ?

    Quote Originally Posted by Artista View Post
    Thanks for the reply .
    I did use Image , Istreams, and bytes class.
    This source helped a lot .
    http://www.codeproject.com/Articles/...y-show-picture
    What does that project have to do with your question?

  6. #6
    Join Date
    Dec 2014
    Posts
    7

    Re: How to insert and read image from database (sql server) using MFC ?

    Quote Originally Posted by GCDEF View Post
    What does that project have to do with your question?
    Download the demo and check the code.
    Actually my real problem was reading the picture then write it to an array of bytes so I used
    "while(cFileStream.Read(array, size)"
    .. And also loading the image I had did transfere bytes to an Istream obj. then using the Image class I loaded it easily.

Tags for this Thread

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

Featured