Fórum Erro na consulta SQL no formato currency. #401871
27/05/2011
0
var
valores, v_maior, vr_menor, percentual: Currency;
begin
valores := StrToFloat(valor.Text); // valor original
percentual := 10.0 / 100.0; // 10%
vr_maior := valores + (percentual * valores);
vr_menor := valores - (percentual * valores);
EditMaior.Text:= FormatCurr(',##0.00', v_maior);
EditMenor.Text:= FormatCurr(',##0.00',v_menor);
Qryqimo.close;
Qryqimo.sql.clear;
Qryqimo.SQL.Add('select * from imovel where imovel.valor between '+(Editmaior.Text)+' and '+(Editmenor.Text)+'');
Qryqimo.open;
end;
Valdir Lima
Curtir tópico
+ 0Posts
29/05/2011
Wilton Júnior
SQL.Add('select * from imovel where valor between '+(Editmaior.Text)+' and '+(Editmenor.Text));
open; end; Cara tenta fazer dessa forma mas eu acho que o problema esta na passagem de float para str.
Gostei + 0
30/05/2011
Valdir Lima
var
valores, valor_maior, valor_menor, percentual: Currency;
begin
valores := StrToFloat(valor.Text); //178.00; // valor original
percentual := 10.0 / 100.0; // 10%
valor_maior := valores + (percentual * valores);
valor_menor := valores - (percentual * valores);
EditMaior.Text:= FormatCurr(',##0.00', valor_maior);
EditMenor.Text:= FormatCurr(',##0.00',valor_menor); with qimo do
begin
Qryqimo.close;
Qryqimo.sql.clear;
Qryqimo.SQL.Add('select * from imovel where imovel.valor between '+(Editmaior.Text)+' and '+(Editmenor.Text)+'');
Qryqimo.open;
end;
end;
end.
Gostei + 0
30/05/2011
Emerson Nascimento
var
valores, valor_maior, valor_menor, percentual: Currency;
begin
valores := StrToFloat(valor.Text); //178.00; // valor original
percentual := 10.0 / 100.0; // 10% HEIN ???????
valor_maior := valores + (percentual * valores);
valor_menor := valores - (percentual * valores);
EditMaior.Text := FormatCurr(',##0.00', valor_maior);
EditMenor.Text := FormatCurr(',##0.00', valor_menor);
with qimo do
begin
Qryqimo.close;
Qryqimo.sql.clear;
Qryqimo.SQL.Add('select * from imovel ');
Qryqimo.SQL.Add('where valor between '+FloatToStr(valor_menor)+' and '+FloatToStr(valor_maior));
Qryqimo.open;
end;
end;
Gostei + 0
30/05/2011
Valdir Lima
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)