How To…Load Report Templates from a Database

Question

“How do I load report templates from a database?”

Solution

Reports can be saved to a database at design-time or run-time.

  1. First, create a database table that contains a BLOB field for storing the templates and a string field for storing the name of the templates:For this example let’s create a table called reports
     Reports
     Name char(40)
     Template blob
  2. Use a DataSet, DataSource, DBPipeline to connect to the reports table.
  3. Bind the Report.Template to the database by setting the required properties.  This can be done by using the Object Inspector or via Delphi code

     
  4. Load and Save a reports a. Use the Designer File | Open and Save options.b. Use Code