Subject | Re: [ib-support] SQL add? |
---|---|
Author | Artur Anjos |
Post date | 2002-04-05T21:30:35Z |
Daniel:
You can not use the Table Name as parameter. And I don't understand why you
set the parameters and next clear the query....
You should use something like this:
// But, if you are using IBO you don't need to explicitly do it
a Delphi problem. You should post your message in some group that is related
to the components you are using (that you didn't not mention also...)
Artur
You can not use the Table Name as parameter. And I don't understand why you
set the parameters and next clear the query....
You should use something like this:
> begindifferent Query
> with QRYT do
> begin
> Close; // Ok, you have close it because you will have a
> SQL.Clear; // Now, you set the SQL// Here, you really should prepare the query again...
> SQL.Add('SELECT * FROM ' + StrTable );
> SQL.Add('ORDER BY :NAME');
// But, if you are using IBO you don't need to explicitly do it
> ParamByName('NAME').asstring := NAME;And this is not a IB/Firebird question, and you are off topic here. This is
> Open;
> end;
>
a Delphi problem. You should post your message in some group that is related
to the components you are using (that you didn't not mention also...)
Artur
----- Original Message -----
From: "Daniel Bertin" <bertin@...>
To: <ib-support@yahoogroups.com>
Sent: Friday, April 05, 2002 9:42 PM
Subject: [ib-support] SQL add?
> Hi all,
> Why can I not execute this query? I get unknown table name error. but if I
> replace the params with the values it's ok. what am I missing?
>
> StrTable := 'ManuFact';
> NAME := 'MANNAME';
>
> begin
> with QRYT do
> begin
> Close;
> Parambyname('TABLE').asString := StrTable;
> ParamByName('NAME').asstring := NAME;
> SQL.Clear;
> SQL.Add('SELECT * FROM :TABLE');
> SQL.Add('ORDER BY :NAME');
> Open;
> end;
>
> Thanks
> Daniel