Solved

How to save image in access database?

Posted on 2001-08-17
11
3,001 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 51

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 51

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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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 50 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying 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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

856 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