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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Populate ImageEnMView from database

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
jccruz Posted - Aug 09 2012 : 17:41:10
Please,

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

Thanks

JCC
2   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Aug 10 2012 : 03:10:02
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
Patrick Quinn Posted - Aug 10 2012 : 00:05:49
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