Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Saving template to stream.

edited January 2005 in General
I have RB7.02 and Delphi 7.
I save the reports in database BLOBs. -(My own structure)
I used to temporarily store the template in file,
and then load it from file and save it to stream,
and save it to the database. But now with XP security
I've had a hard time giving access to users to specific windows locations.
And I prefer:
1. Save the template directly to stream and
2. Save the stream to database. - No file system at all.

The problem is the following.
On the event OnClose of the designer, the changed template
is not available as stream according to the following code:

procedure TfrmDLGQueryReports.dnResultClose(Sender: TObject;
var Action: TCloseAction);
var rep:TMemoryStream;
r:Integer;
begin
r := Application.MessageBox(Pchar('Save changes before close?'),
PChar('Save Confirmation'),
MB_YESNOCANCEL);

if r=IDOK then begin
rep := TMemoryStream.Create;
try
//Save template to stream
repResult.Template.SaveToStream(rep);
//Save stream to database
dsReports.Edit;
dsReportsREPORT.LoadFromStream(rep);
dsReports.Post;
finally
rep.Free;
end;
end else if r=IDCANCEL then begin
Action := caNone;
end;

end;


I also tried to use the events OnSaveStart and OnSaveEnd of the template but
they never fired.

Please help on this.

Thanks
Juan Jose

Comments

  • edited January 2005
    oops!
    Sorry, not a RB issue!
    answer:

    Thanks
    Juan Jose.

This discussion has been closed.