AdoQuery.SQL.Add('select count(*) from Table);
AdoQuery.SQL.Add('select count(*) from Table);
Where do I find the result (without using DBEdit connected to the DataSource & datafield=Expr1000)?
Where do I find the result (without using DBEdit connected to the DataSource & datafield=Expr1000)?
var
ReplyDeleteiCount: integer;
begin
AdoQuery.SQL.Add('select count(*) from Table);
try
AdoQuery.Open;
iCount := AdoQuery.Fields[0].AsInteger;
AdoQuery.Close;
except
iCount := -1;
end;
end;
or the easy way:
ReplyDelete...
AdoQuery.SQL.Add('select * from table');
AdoQuery.Open;
icount:=AdoQuery.RecordCount;
AdoQuery.Close;
...
Heinz Toskano Yeah and the easy way then transfers the bazillion records over the net into your ADOTable...
ReplyDeleteStefan Glienke using Recordcount is a bit lame ; I propose
ReplyDeleteWhile not AdoQuery.Eof do inc(icount);
Olivier SCHWAB LOL /facepalm
ReplyDeleteStefan Glienke You're right, maybe not the best way, but it's easier and works... and will waste a lot of resources and time.
ReplyDeleteSeriously Olivier SCHWAB? ;-)
Sorry Heinz Toskano , bad monday at work , so my tongue is a little bit sarcastic ;)
ReplyDeleteOlivier SCHWAB np man, we all have a bad day, sometimes, specially mondays, mine is just about to begin ;-)
ReplyDeleteAbderak open the dataset and get Fields[0].value
ReplyDelete