Direct entry of SQL
I have an invoice routine which uses 2 temporary Advantage SQL tables to
hold the data before the invoice is checked, printed and then committedd to
the database.
I am trying to set the report SQL text under program control as the names of
the tables are random numbers and the location varies per installation. When
I call the iSQL.Clear I get an exception generated.
What have I missed out of the sample code below?
Thanks in advance
Philip L Jackson
var iSQL:TdaSQL;
InvoiceReports := TppReport.Create(self);
with InvoiceReports do
begin
template.filename := path + '\' + InvTemplate;
Template.LoadFromFile;
iSQL.Clear;
isql.SQLText.Add('select inv.*, trans.*');
isql.SQLText.Add('from ' + OpenCal.tempdirectory +
'\I00123.adt inv INNER JOIN');
isql.SQLText.Add(OpenCal.tempdirectory + '\t43209.adt
trans on');
isql.SQLText.Add('(trans.del_note_no =
inv.del_note_no)');
PrinterSetUp.DocumentName := 'Delivery Note Invoice ';
hold the data before the invoice is checked, printed and then committedd to
the database.
I am trying to set the report SQL text under program control as the names of
the tables are random numbers and the location varies per installation. When
I call the iSQL.Clear I get an exception generated.
What have I missed out of the sample code below?
Thanks in advance
Philip L Jackson
var iSQL:TdaSQL;
InvoiceReports := TppReport.Create(self);
with InvoiceReports do
begin
template.filename := path + '\' + InvTemplate;
Template.LoadFromFile;
iSQL.Clear;
isql.SQLText.Add('select inv.*, trans.*');
isql.SQLText.Add('from ' + OpenCal.tempdirectory +
'\I00123.adt inv INNER JOIN');
isql.SQLText.Add(OpenCal.tempdirectory + '\t43209.adt
trans on');
isql.SQLText.Add('(trans.del_note_no =
inv.del_note_no)');
PrinterSetUp.DocumentName := 'Delivery Note Invoice ';
This discussion has been closed.
Comments
How are you connecting your report to the data? Are you using DADE or
datapipelines? Remember when loading templates, unless you are using DADE,
the datapipeline and event names will have to be idenitcal to the ones
created when the template was.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com