Report.Template.New (stDatabase)
It's possible that the TemplateField is corrupted, but the record still exists in the database. I want to reset the report, so I do this:
Try
Report.Template.LoadFromDatabase;
except
on E: Exception do begin
Report.FreeModules;
Report.Template.New;
MessageDlg(E.ToString, mtError, [mbOk], 0);
end;
end;
Designer.ShowModal;
The designer opens with a new report. But when I try to save, a new record is automatically created in the reports table. I don't want this, since there's already a record with a broken template. How is it possible to control such a situation ?
Serg
Try
Report.Template.LoadFromDatabase;
except
on E: Exception do begin
Report.FreeModules;
Report.Template.New;
MessageDlg(E.ToString, mtError, [mbOk], 0);
end;
end;
Designer.ShowModal;
The designer opens with a new report. But when I try to save, a new record is automatically created in the reports table. I don't want this, since there's already a record with a broken template. How is it possible to control such a situation ?
Serg
Comments
You will likely need to perform the swap manually. Something like the following:
1. Delete the existing (corrupted) template from the DB manually.
2. Create a new template and save it to stream (Template.SaveToStream).
3. Manually save the new template to the existing record's Template field.
4. Load the new report normally.
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com