ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Populate ImageEnMView from database
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

jccruz

Brazil
30 Posts

Posted - Aug 09 2012 :  17:41:10  Show Profile  Reply
Please,

I would like to know how can I populate a ImageEnMView from a database.

Thanks

JCC

Patrick Quinn

United Kingdom
81 Posts

Posted - Aug 10 2012 :  00:05:49  Show Profile  Reply
Here's how I am dong it. There is an ImageEn demo too.
Note that I am using TABSTable from Absolute Database, a BDE replacement, but code using BDE will be almost identical - just use a TTable and TBlobstream instead. The line creating the Blobstream will be slightly different too.

Absolute Database: http://www.componentace.com/bde_replacement_database_delphi_absolute_database.htm

procedure FillImageEnMViewFromTable(ImageEnMView: TImageEnMView;
ABSTable: TABSTable; sFieldName: string);
var
MemStream: TMemoryStream;
BlobStream: TABSBlobStream;
OrigRec, i: integer;
begin
ImageEnMView.Clear;
with ABSTable do
begin
OrigRec := RecNo;
First;
while not EOF do
begin
MemStream := TMemoryStream.Create;
try
// The next line needs changing for BDE
BlobStream := TABSBLOBStream(ABSTable.CreateBlobStream(ABSTable.FieldByName(sFieldname), bmRead));
try
MemStream.CopyFrom(BlobStream, BlobStream.Size);
MemStream.Position := 0; // Don't forget this!
with ImageEnmView do
begin
i := AppendImage;
SetImageFromStream(i, MemStream);
ImageID[i] := RecNo;
end;
finally
BlobStream.Free;
end;
finally
MemStream.Free;
end;
Next;
end;
RecNo := OrigRec;
end;
end;

Hope that helps.

Patrick
Go to Top of Page

xequte

38615 Posts

Posted - Aug 10 2012 :  03:10:02  Show Profile  Reply
Thanks Patrick,

You can see our demo for it at:

http://www.imageen.com/demos/Database/DBMView/DBMView.zip


The source is in your ImageEn folder at:

/demos/Database/DBMView/DBMView.dpr

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: