Solved

How to save image in access database?

Posted on 2001-08-17
11
2,983 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 49

Expert Comment

by:Ryan Chong
Comment Utility
Hi sonuzip,

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

Author Comment

by:sonuzip
Comment Utility
Is it Risky??? Do u think that it will take a more load?
0
 
LVL 49

Expert Comment

by:Ryan Chong
Comment Utility
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
 
LVL 18

Expert Comment

by:deighton
Comment Utility
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
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 6

Expert Comment

by:pierrecampe
Comment Utility
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 50 total points
Comment Utility
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
Comment Utility
0
 
LVL 28

Expert Comment

by:iboutchkine
Comment Utility
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
Comment Utility
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
Comment Utility
Per recommendation, force-accepted.

Netminder
CS Moderator
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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…
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 process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

763 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now