Good afternoon.
I work on a legacy system and need to put information from a query into a single memo object.
Code follows.
MyQuery.Close;
with MyQuery.SQL do
begin
clear;
add(' select TOP 8 nuentrada, dstpleitu, vlleitura, dshint, dtleitura, hhleitura ');
add(' from ssdentsinaisvitais inner join ssttplei on ssdentsinaisvitais.cdleitura = ssttplei.cdleitura ');
add(' where nuentrada = ' + lblnuentrada.Caption);
add(' order by dtleitura desc, hhleitura desc ');
end;
MyQuery.Open;
while MyQuery.Eof do
begin
mmdsexamefisico.Text := mmdsexamefisico.Text + MyQuery.DataSource.DataSet.FieldByName('dstpleitu').AsString + ': ';
mmdsexamefisico.Text := mmdsexamefisico.Text + MyQuery.DataSource.DataSet.FieldByName('vlleitura').AsString + #13#10;
end;
A syntax error occurs next to the word order.
Can you detect the error?
The% formed% is as follows:
SELECT TOP 8 nuentrada,
dstpleitu,
vlleitura,
dshint,
dtleitura,
hhleitura
FROM ssdentsinaisvitais
INNER JOIN ssttplei ON ssdentsinaisvitais.cdleitura = ssttplei.cdleitura
WHERE nuentrada = 350000701778
ORDER BY dtleitura DESC,
hhleitura DESC