?
Solved

How to save image in access database?

Posted on 2001-08-17
11
Medium Priority
?
3,016 Views
Last Modified: 2007-12-19
I've to save my image in database.  I'm using Access.
0
Comment
Question by:sonuzip
11 Comments
 
LVL 54

Expert Comment

by:Ryan Chong
ID: 6396535
Hi sonuzip,

It is recommended that save the path of image rather than the image itself in database ..
0
 

Author Comment

by:sonuzip
ID: 6396581
Is it Risky??? Do u think that it will take a more load?
0
 
LVL 54

Expert Comment

by:Ryan Chong
ID: 6396603
Hi sonuzip,

You need to use OLE object to display the image in database. Futher more the size of database will increase extremely..

See what JDettman comment in Access part in EE: http://www.experts-exchange.com/jsp/qShow.jsp?ta=msaccess&qid=20169577

'Hope will help.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 18

Expert Comment

by:deighton
ID: 6396689
you can do this with Access!  I've got code at home to store images & display them by key.  

I'll try & remember to post it in about 12 hours time
0
 
LVL 6

Expert Comment

by:kahlean
ID: 6396696
concur ryansys, saving the path is much better in terms of database managebility and also efficiency. But remember if you intend to save as the path name you must maintain the consistency in keeping your picture.

Regards
0
 
LVL 6

Expert Comment

by:pierrecampe
ID: 6396768
keeping the images in their own file may seem ok but it can be a lot of files to manage
i would recommend using a separate db just to store the images and in the original db just store their id's
this in effect has the result of a 1 to 1 relationship between the tables but then across databases
0
 
LVL 3

Accepted Solution

by:
RodStephens earned 200 total points
ID: 6397037
This example uses AppendChunk and GetChunk to save and restore pictures in a database:

    http://www.vb-helper.com/HowTo/dbpict.zip
0
 
LVL 1

Expert Comment

by:Chroma
ID: 6397596
0
 
LVL 28

Expert Comment

by:iboutchkine
ID: 6397891
Const MAX_PATH = 255
private Const CHUNK_SIZE = 1000
private Declare Function GetTempPath Lib "kernel32" _
    Alias "GetTempPathA" (byval nBufferLength as Long, _byval lpBuffer as string) as Long
public Function SavePictureToDB(PictControl as Object, _  
   RS as Object, FieldName as string) as Boolean

'PURPOSE: SAVES PICTURE IN IMAGEBOX, PICTUREBOX, OR SIMILAR
'CONTROL to RECORDSET RS IN FIELD NAME FIELDNAME
'FIELD TYPE MUST BE binary (OLE OBJECT IN ACCESS)

 'SAMPLE USAGE
'Dim sConn as string
'Dim oConn as new ADODB.Connection
'Dim oRs as new ADODB.Recordset''
'sConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\MyDb.MDB;Persist Security Info=false"'
'oConn.Open sConn
'oRs.Open "SELECT * FROM MYTABLE", oConn, adOpenKeyset, _  
    adLockOptimistic
'oRs.AddNew
 'SavePictureToDB Picture1, oRs, "MYFIELD"
'oRs.Update
'oRs.Close
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7202351
Hi sonuzip,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept RodStephens's comment(s) as an answer.

sonuzip, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 
LVL 5

Expert Comment

by:Netminder
ID: 7215952
Per recommendation, force-accepted.

Netminder
CS Moderator
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month14 days, 16 hours left to enroll

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question