Board index » delphi » SQL statements in object inspector

SQL statements in object inspector

Hi,

I am using Delphi 5 and a lot of TQuery components in which I fill in the
SQL-statement at runtime using something like:

Query.SQL.Add('select * from something');
Query.SQL.Add('where Field1 = 0 and');
Query.SQL.Add('Field 2 <> "Test"');
Query.SQL.Add('order by Field1');

These are four lines and while I am debugging I want to review all lines
together to see if the statement is correct.
The only way I know to do this is to put every lines one by one in the
Object inspector. This is very anoing, especially with bigger SQL
statements.

Any suggestions?

Erwin Krijnen.

 

Re:SQL statements in object inspector


I assume your are talking about the Evaluate window or the Watch List and
not the Object Inspector.
If you monitor Query.SQL.Text you will see the entire text (with #$0d#$0a as
line separators).
If you don't want to see the line separators you should build your queries
with:

Query.SQL.Text :=
  'select * from something ' +
  'where Field1 = 0 ' +
  'and Field 2 <> "Test" ' +
  'order by Field1';

Quote
"Erwin Krijnen" <n...@nospawm.cifera.nl> wrote in message

news:_qKg7.82575$z7.867250@dbsch1.home.nl...
Quote
> Hi,

> I am using Delphi 5 and a lot of TQuery components in which I fill in the
> SQL-statement at runtime using something like:

> Query.SQL.Add('select * from something');
> Query.SQL.Add('where Field1 = 0 and');
> Query.SQL.Add('Field 2 <> "Test"');
> Query.SQL.Add('order by Field1');

> These are four lines and while I am debugging I want to review all lines
> together to see if the statement is correct.
> The only way I know to do this is to put every lines one by one in the
> Object inspector. This is very anoing, especially with bigger SQL
> statements.

> Any suggestions?

> Erwin Krijnen.

Other Threads