Aquadp
asked on
About Database and Image
hello!
I want to ask a question!
if a picture's style is .JPG,
how to load the picture to a OLE field of a table?
(I'm using Microsoft Access 2000)
thanks!!!
I want to ask a question!
if a picture's style is .JPG,
how to load the picture to a OLE field of a table?
(I'm using Microsoft Access 2000)
thanks!!!
TBlobField(table1.fieldbyn ame('AFiel dName')).L oadfromfil e; // or loadfromstream
hello?
ASKER
OH!
But When i run my program,it's displaying the error dialog that it can't load the JPG image to the OLE field!
???
what happened?
how to do!
Help!
But When i run my program,it's displaying the error dialog that it can't load the JPG image to the OLE field!
???
what happened?
how to do!
Help!
what for a control do you use for display?
ASKER
the controls of displaying are Images or DBImages.
when they were ready to load JPG images,system displayed the error dialog.
is the error belong to Delphi's Bug?
when they were ready to load JPG images,system displayed the error dialog.
is the error belong to Delphi's Bug?
hi,
jpg isn't supported by default,
therefore you can't use a tdbimage
but you can use a timage like
uses jpeg; //add jpeg into the uses clause
var
j : TJpegImage;
m : TMemoryStream;
begin
j := TJpegImage.Create;
m := TMemoryStream.Create;
try
if not dataset.fieldbyname('Field Name').IsN ull then //only if available
begin
TBlobField(dataset.fieldby name('Fiel dName')),S aveToStrea m(m);
m.position := 0;
j.loadfromstream(m);
image1.picture.bitmap.assi gn(j);
end;
finally
j.free;
m.free;
end;
end;
just from head,
use this code in the afterscroll-event of your dataset
meikl ;-)
jpg isn't supported by default,
therefore you can't use a tdbimage
but you can use a timage like
uses jpeg; //add jpeg into the uses clause
var
j : TJpegImage;
m : TMemoryStream;
begin
j := TJpegImage.Create;
m := TMemoryStream.Create;
try
if not dataset.fieldbyname('Field
begin
TBlobField(dataset.fieldby
m.position := 0;
j.loadfromstream(m);
image1.picture.bitmap.assi
end;
finally
j.free;
m.free;
end;
end;
just from head,
use this code in the afterscroll-event of your dataset
meikl ;-)
ASKER
THANKS A LOT!
Now i see.
Good luck 4 u~~~~
Now i see.
Good luck 4 u~~~~
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.