?
Solved

How to save image in access database?

Posted on 2001-08-17
11
Medium Priority
?
3,011 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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

764 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