Board index » delphi » simple query/alias problem

simple query/alias problem

when I run sql1 and sql2 below
from the sql editor sequentially they
work fine.

when I try to run them in code on a form
I get an error message invalid filename.
Can someone tell me why I get the invalid
filename message?

I want to learn to set the private directory to
something other than c:\pdoxwin\private
because when I install the program
paradox wont be on the computer.

if combobox3.text='Report1' then
begin
query1.active:=false;
query1.sql.loadfromfile('sql1.TXT');
query1.active:=true;
if query1.recordcount > 0 then
begin
query1.active:=false;
query1.sql.loadfromfile('sql2.TXT');
query1.active:=true; {error message occcurrs here}
end;
end;

{THIS IS SQL1.TXT}
SELECT d.NAME, SUM(d1.RESULT)AS RESULT
FROM "People.db" d, "Picks.db" d1
WHERE
(d1."INDEX" = d."INDEX")
GROUP BY d.NAME

{THIS IS SQL2.TXT}
select name,result
from ":PRIV:answer.db"
where result=
 (select max(result) as result
 from ":PRIV:answer.db")
 order by name

thanks for helping

 

Re:simple query/alias problem


So far as I know, the alias :PRIV: only has meaning in programs
like Paradox for Windows and Database Desktop.  When running
a Delphi program, by default temporary tables and result tables
would be written to the same directory the executable is in,
unless you specify a private directory using code like
  Session.PrivateDir := 'C:/TEMP';

Also, the behavior of writing the query result to a table called
:PRIV:ANSWER.DB is something that only happens in programs like
Paradox for Windows and Database Desktop.  To reference the results
of the first query, I would use a BatchMove component to write the
query result to a table.  There may also be a way for a second query
component to reference the first query's result, but I'm not familiar
with it.
--
Rick Carter
carte...@email.uc.edu

Other Threads