Board index » delphi » QuickReport is not very quick

QuickReport is not very quick

I have strugled with QuickReport, and is finally beginning to learn how to
do it, BUT you have to put your data in a database. WHY !! I do not get it,
but that has nothing to do with what I want to ask about.
I want to (at runtime) make a database (TTable, TDataSource.....) and put
data in it. Print it on QuickReport and DESTROY the database afterwards.
BUT it get all these weard messages when I try to create the TTable. I write
Table1:=TTable.Create;
BUT CRASH. I cannot use it for very much. So I ask you to write a tiny bit
of code to create the table use the table and delete the table again. ALL in
runtime. No DataBase Desktop and ......
Please mail me at p...@nddata.dk as soon as possible

Peter Aagaard Kristensen

 

Re:QuickReport is not very quick


Quote
>I have strugled with QuickReport, and is finally beginning to learn how to
>do it, BUT you have to put your data in a database. WHY !!

Because that is what most people want to do with it
However you do not have to have a table.  See the OnNeedData event if
you want to supply the report with data outside of a table.

I do not get it,

Quote
>but that has nothing to do with what I want to ask about.
>I want to (at runtime) make a database (TTable, TDataSource.....) and put
>data in it. Print it on QuickReport and DESTROY the database afterwards.
>BUT it get all these weard messages when I try to create the TTable. I write
>Table1:=TTable.Create;

Try
Table1:=TTable.Create(nil)

Quote
>So I ask you to write a tiny bit of code to create the table use the table

Table1:=TTable.Create(nil)
withTable1 Do
Try
DatabaseName := 'DBDEMOS';
  TableType := ttParadox;
  TableName := 'CustInfo';
  with FieldDefs do
  begin
    Clear;
    Add('Field1', ftInteger, 0, True);
    Add('Field2', ftString, 30, False);
  end;
  with IndexDefs do
  begin
    Clear;
    Add('', 'Field1', [ixPrimary, ixUnique]);
    Add('Fld2Indx', 'Field2', [ixCaseInsensitive]);
end;
  CreateTable;
 active := true
edit
  fieldByName('=Field1').asInteger := 1;
  fieldByName('=Field2').asString := 'Cow';
 post;
active := false;
Finally
free
end;

--
Brian Bushay (TeamB)
Bbus...@DataGuidance.com

Re:QuickReport is not very quick


To create a table in runtime you could try something like this:

For the following code to work uoy will have to have at database table named
TEST.DB, with two fields in it.
These fields are named as in the code.

procedure TForm1.Button1Click(Sender: TObject);
var
  MyTable : TTable;
begin
  with MyTable do
  begin
    try
      MyTable := TTable.Create(Self);
      DatabaseName := '';
      Tablename := 'TEST.DB';
      try
        Open;
        First;
        ShowMessage(FieldByName('FirstName').asstring + ' ' +
FieldByName('LastName').asstring);
        Close;
      except
        on EDBEngineError do
          Showmessage('Some databaseerror occurred...');
      end;
    finally
      Free;
    end;
  end;
end;

Quote
Peter Aagaard Kristensen wrote in message

<6ca6kc$n...@forums.borland.com>...
Quote
>I have strugled with QuickReport, and is finally beginning to learn how to
>do it, BUT you have to put your data in a database. WHY !! I do not get it,
>but that has nothing to do with what I want to ask about.
>I want to (at runtime) make a database (TTable, TDataSource.....) and put
>data in it. Print it on QuickReport and DESTROY the database afterwards.
>BUT it get all these weard messages when I try to create the TTable. I
write
>Table1:=TTable.Create;
>BUT CRASH. I cannot use it for very much. So I ask you to write a tiny bit
>of code to create the table use the table and delete the table again. ALL
in
>runtime. No DataBase Desktop and ......
>Please mail me at p...@nddata.dk as soon as possible

>Peter Aagaard Kristensen

Other Threads