Como colocar num Edit -gt; select sum(valor) from Banco??
tenho um edit normal, agora eu quero q esse edit receba a soma de uns valores(select sum(valor) from banco) como eu faço isso???
Mestre5
Curtidas 0
Respostas
Poeta Noturno
07/06/2004
Como vai mestre5?
se você tiver usando tecnologia de acesso DBExpress, use o seguinte código:
var
ResultSet: TCustomSQLDataSet;
SQLStmt: string;
begin
SQLStmt := ´select sum(valor) as Total from banco´;
ResultSet := nil;
try
tbls.SQLConnection1.Execute(SQLStmt, nil, @ResultSet);
if Assigned(ResultSet) then
Edit1.Text := FloatToStr(ResultSet.fieldByName(´Total´).AsInteger);
Finally
ResultSet.Free;
end;
Espero ter ajudado nessa amigo.
Poeta Noturno
se você tiver usando tecnologia de acesso DBExpress, use o seguinte código:
var
ResultSet: TCustomSQLDataSet;
SQLStmt: string;
begin
SQLStmt := ´select sum(valor) as Total from banco´;
ResultSet := nil;
try
tbls.SQLConnection1.Execute(SQLStmt, nil, @ResultSet);
if Assigned(ResultSet) then
Edit1.Text := FloatToStr(ResultSet.fieldByName(´Total´).AsInteger);
Finally
ResultSet.Free;
end;
Espero ter ajudado nessa amigo.
Poeta Noturno
GOSTEI 0