how to save query from delphi form to RB
hello
In my application i have written a query using Tquery component .The
query is
SELECT * FROM table1 WHERE name= :lname AND date BETWEEN :stdate
AND :edate
I am passing the parameters lname,sdate,edate from the delphi form to the
query when user click the 'show report' button and then the report is
generated in RB7.the code is
qurParno.Close;
qurParno.ParamByName('locname').AsString:=cmbxLocaName.Text;
qurParno.parambyname('stdate').AsDate:=dtpstartdate.date;
qurParno.parambyname('edate').AsDate:=dtpEndDate.date;
qurParno.Open;
The problem with above approach is that the query is executed only on
clicking the button . In the application user can create his own report
also and open them from menu .But if user wants to open already creted
report which is using the query from the delphi form without clicking on
the 'show report' button he will not get any data in the report
because query is not being executed.
One solution is that while saving the report user can save the query
executed from delphi form on the event 'OnCustomSave' of
designer componenet.But i am not getting how to do so.
If some other approach is also possible to above problem then please
provide me with example.
I am using Report Builder 7.
thanks a lot for your help
Lucy
--- posted by geoForum on http://delphi.newswhat.com
In my application i have written a query using Tquery component .The
query is
SELECT * FROM table1 WHERE name= :lname AND date BETWEEN :stdate
AND :edate
I am passing the parameters lname,sdate,edate from the delphi form to the
query when user click the 'show report' button and then the report is
generated in RB7.the code is
qurParno.Close;
qurParno.ParamByName('locname').AsString:=cmbxLocaName.Text;
qurParno.parambyname('stdate').AsDate:=dtpstartdate.date;
qurParno.parambyname('edate').AsDate:=dtpEndDate.date;
qurParno.Open;
The problem with above approach is that the query is executed only on
clicking the button . In the application user can create his own report
also and open them from menu .But if user wants to open already creted
report which is using the query from the delphi form without clicking on
the 'show report' button he will not get any data in the report
because query is not being executed.
One solution is that while saving the report user can save the query
executed from delphi form on the event 'OnCustomSave' of
designer componenet.But i am not getting how to do so.
If some other approach is also possible to above problem then please
provide me with example.
I am using Report Builder 7.
thanks a lot for your help
Lucy
--- posted by geoForum on http://delphi.newswhat.com
This discussion has been closed.
Comments
When loading saved reports (i.e. templates) your best option is to keep all
data access local to the template using the data workspace (DADE). This way
when a user loads a template, the correct SQL is already created and
executed with that report. The approach you mention below may work but as
your application becomes more advanced with more data involved you will most
likely run into problems keeping everything connected to the correct report.
Keeping virtually everything local to the template using DADE and RAP is the
way to go.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com