Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 02-23-2010, 05:09 PM
Josh Josh is offline
Junior Member
 
Join Date: Feb 2010
Posts: 9
Default insert a image into a microsoft access database

hi,

i am currently using delphi 2007, i am wanting to be able to add a image(prefrebly jpeg) into a access database. i have tried doing this but i cant as it does not insert correctly, has anyone made any code or anything similar to this to help me out?

this is the code i am currently using to add it to the database

begin
opendialog1.Execute;
with adotable1 do
begin
Edit;
(fieldbyName('Picture') as Tblobfield).loadfromFile(opendialog1.filename);
Post;
end;

this is the code i am using where i am wanting to search my files for an image and then i want it to be inserted into the database, however i get the error message saying my bitmap is not valid....

what do i do to solve this issue?

thanks in advance.
Reply With Quote
  #2  
Old 02-24-2010, 01:21 PM
MrBaseball34 MrBaseball34 is offline
Senior Member
 
Join Date: Jan 2001
Posts: 7,260
Default

What is the Access FieldType for the Picture field?
__________________
MrBaseball34

Hook 'em Horns
2005 College Football National Champions
2005 College Baseball National Champions
Reply With Quote
  #3  
Old 02-24-2010, 08:06 PM
Josh Josh is offline
Junior Member
 
Join Date: Feb 2010
Posts: 9
Default

i set it as an OLE image.
Reply With Quote
  #4  
Old 02-24-2010, 09:16 PM
MrBaseball34 MrBaseball34 is offline
Senior Member
 
Join Date: Jan 2001
Posts: 7,260
Default

Have you seen this article?
http://delphi.about.com/od/database/l/aa030601a.htm
__________________
MrBaseball34

Hook 'em Horns
2005 College Football National Champions
2005 College Baseball National Champions
Reply With Quote
  #5  
Old 02-24-2010, 09:47 PM
Josh Josh is offline
Junior Member
 
Join Date: Feb 2010
Posts: 9
Default

yes, ive just tried using that, but i could not get it to work as i dont have the rx library.
anyway i figured out how to add an image to a database, however it is saved as long binary data, how do i load this in delphi? i have no idea how to make this work.
Reply With Quote
  #6  
Old 02-25-2010, 01:36 AM
MrBaseball34 MrBaseball34 is offline
Senior Member
 
Join Date: Jan 2001
Posts: 7,260
Default

Let me check out some other things.
__________________
MrBaseball34

Hook 'em Horns
2005 College Football National Champions
2005 College Baseball National Champions
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 01:39 PM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.