Friday, 15 January 2010

delphi - Database image to TImage -



delphi - Database image to TImage -

why code not working:

saving images fine code (also see image in reports):

gallery.append; gallery.fieldbyname('image').assign(pic.picture.bitmap); gallery.post;

however code:

gallery.insert; s := createblobstream(gallery.fieldbyname('image'), bmwrite); image1.picture.bitmap.savetostream(s); gallery.post; s.free;

results in error 'dataset not in edit or insert mode'. used first one.

but getting form in timage results in "invalid bitmap format"

var s : tstream ; s := gallery.createblobstream(gallery.fieldbyname('image'), bmread); pic.picture.bitmap.loadfromstream(s); s.free;

the error shows image. tried dbimage using tutorial about.com , maintain getting error. database access 2010 , image field ole (blob). kinda stuck.

s

i figure out:

this how can display jpg image access database timage:

the access database field ole (or blob).

save image database using code

gallery.append; gallery.fieldbyname('image').assign(pic.picture.bitmap); gallery.post;

the gallery adotable , image access field name containing image. display image delphi timage component: 1. in uses clause 1 contains unit uses (file --use unit) put:

uses jpeg

then utilize code display image:

var jpg:tjpegimage; begin jpg :=tjpegimage.create; jpg.assign(tblobfield(gallery.fieldbyname('image'))); pic.picture.bitmap.assign(jpg); jpg.free; end;

how cool that.

delphi delphi-xe2

No comments:

Post a Comment