CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2006

    Question Save images in Access Using ADO in VB6

    How To Save Image File as OLE Object in Access OLE Object Field using ADO as database access object in VB6

  2. #2
    Join Date
    Jun 2004
    Kashmir, India

    Re: Save images in Access Using ADO in VB6

    Welcome to the Forum

    Take a look at our FAQ, you will see couple of threads that will help you solve your problem.


  3. #3
    Join Date
    Sep 2006

    Re: Save images in Access Using ADO in VB6

    i hope it's useful
    sub SaveImg(Path a string)
    Dim rs As ADODB.Recordset
    Set rs = New ADODB.Recordset
    Dim mystream As New ADODB.Stream
    Set mystream = New ADODB.Stream
    mystream.Type = adTypeBinary
    rs.CursorLocation = adUseClient
    rs.ActiveConnection = ConnectionString
    rs.Open "SELECT id_TABLE,info,image FROM imagenes where ID_TABLA=condition" 'condition must be value that return 0 recordsets
    mystream.LoadFromFile path
    rs.Fields("image") = mystream.Read
    rs.Fields("info") = "bmp"
    end sub
    and ID_TABLA is primary of table
    Last edited by hensa22; October 16th, 2006 at 08:15 AM.

  4. #4
    Join Date
    Oct 2006

    Re: Save images in Access Using ADO in VB6

    I am handling a large-scale project entitled as MIS (Marketing information System). I am using Vb 6 as front end, Ms Access as back end and Crystal report 8 as reporting tool.

    1) In the project i am required to save customers image to database, and it should be shown in individual customerís report, which will include that image. I had taken OLE field in the database to save images. I had taken Common dialog box control to select image and display it in OLE control, but i don't know how to save the OLE controls image to database. i am using ADO object to access the database. How could I can save and retrieve the image from database? Is it possible to save images by using other controls like Picture box or image control in the form? I want to save image as bitmap in the database.

    2) The size of project is very large then it is useful to store image to database? Will it make it slower to access database?

    3) Saving path of image in database will make any difference? If i do so then how can show the images in report (Crystal report 8)?

  5. #5
    Join Date
    Feb 2005
    Kolkata, India

    Re: Save images in Access Using ADO in VB6

    When working images in Database, the type of project you are working on, use small pictures. Because the whole database will be loaded with data and loading big image data will make it very big and you will face problems. Try to store images as small as possible. This will also make you loading and saving time short as byte by byte will be stored into the database and will be retreaved.

    The access time of a record depends on the size, struncture of a database and also the processor speed, if you have a pentium III amd have a huge database it is obvious that it will take time to load and save data.

    Saving path of images are good practice but it have many disadvantage. Once the folder you store the image get moved you are unable to load the images. Moreover you cannot protect a particular image from loading as it is open. If any one renamed an image but you have a different name in the database you cannot retrieve the same.

    Hope i have been able to give your some information.

    Try, Try Hard, Try Harder one day you will Succeed.

  6. #6
    Join Date
    Oct 2006

    Re: Save images in Access Using ADO in VB6

    Thanx amarjitamar,
    Your suggestions will help me out! Thx once again

Posting Permissions

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.