Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to save image in access database?

Posted on 2001-08-17
11
Medium Priority
?
3,015 Views
Last Modified: 2007-12-19
I've to save my image in database.  I'm using Access.
0
Comment
Question by:sonuzip
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
11 Comments
 
LVL 53

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 53

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
Technology Partners: 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
Suggested Courses

609 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