Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to store image in a database

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi ,
Can anyone tell me how can I store a image into a database and how do i retrieve it from the database.

Thanks
 
You can do this using a pradox table and creating a Blob Graphic field (G). There is an example of this in the Delphi Helpfile called "Displaying Images".

To view an image you can simply use the DBImage component.
 
Hi Eric,

I am using sybase.
will it be the same for sybase as paradox.

i had tried using streams to copy the image to a blob field in the database,but i got a error saying invalid blob length.
is there another way to do this


Bye
 
Yep, you have done it too...

You can't upload images bigger than 32768 bytes, unless changing a lot of properties in the TDatabase & TQuery object.

Another way to do it is to use "Live tables". I'm storing applications and more in the database, and the filesize of reaches 7 Mb, and we are using a Sybase server.

Solution. Make a table with 2 fields (At least). The first field is the Filename and it's unique indexed. The second field is the Data field, without index.

Then use the TTAble component and use the fieldfunction TBlobField.LoadFromFile and TBlobField.SaveToFile

 
Hi Nordlund,

Thanks a lot.

This works just fine

Thanks once again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top