Fórum erro com campos Double Precision #214452
16/02/2004
0
Seguinte, quando eu gravo um valor com virgula no meu sistema, ele simplesmente ignora a virgula
to usando interbase 6, o campo é double precision e o código é o seguinte:
if not MySQL(dm.qryGenerica,´insert into produtos (cod,produto,preco,unMed,dtInc,prcusto,narrativa) values ´+
´(´+lblCod.caption+´,´+QuotedStr(edtProduto.text)+
//esse ta com problema
´,´+QuotedStr(edtPreco.text)+
´,´+quotedstr(cmbUnMed.text)+
´,´+quotedstr(lblDate.caption)+
//e esse também...
´,´+QuotedStr(edtPrecoCusto.text)+
´,´+quotedstr(mm.lines.text)+´)´) then
Application.messagebox(´Erro tentando gravar na tabela de Produtos...´,´Erro´,
mb_ok+mb_iconerror)
Alguém pode me ajudar?
Grato.
-----------------------
Gustavo Lange
Téc. Informática
gustavo@joscil.com.br
-----------------------
Gustavolange
Curtir tópico
+ 0Posts
16/02/2004
Adilsond
function TranlateVal(Value: String): String; var I: Word; S: String; begin S := ´0´; for I := 0 to Length(Value) do begin if Value[I] in [´0´..´9´] then S := S + Value[I] else if Value[I] = ´,´ then S := S + ´.´; end; end;
Troque QuotedStr(edtPreco.text) por TranlateVal(edtPreco.text)
Gostei + 0
16/02/2004
Adilsond
function TranlateVal(Value: String): String; var I: Word; S: String; begin S := ´0´; for I := 0 to Length(Value) do begin if Value[I] in [´0´..´9´] then S := S + Value[I] else if Value[I] = ´,´ then S := S + ´.´; end; end;
Altere a função acima por esta:
function TranlateVal(Value: String): String; var I: Word; S: String; begin S := ´0´; if Length(Value) > 0 then begin for I := 0 to Length(Value) do begin if Value[I] in [´0´..´9´] then S := S + Value[I] else if Value[I] = ´,´ then S := S + ´.´; end; end; Result := S; end;
Gostei + 0
16/02/2004
Gustavolange
function TranlateVal(Value: String): String; var I: Word; S: String; begin S := ´0´; for I := 0 to Length(Value) do begin if Value[I] in [´0´..´9´] then S := S + Value[I] else if Value[I] = ´,´ then S := S + ´.´; end; end;
function TranlateVal(Value: String): String; var I: Word; S: String; begin S := ´0´; if Length(Value) > 0 then begin for I := 0 to Length(Value) do begin if Value[I] in [´0´..´9´] then S := S + Value[I] else if Value[I] = ´,´ then S := S + ´.´; end; end; Result := S; end;
Deu ´Range Check Error ´
qq eu fasso?
Gostei + 0
16/02/2004
Adilsond
for I := 0 to Length(Value) do
por
for I := 1 to Length(Value) do
Gostei + 0
16/02/2004
Gustavolange
Ok. Vou testar e qualque coisa volto a perguntar.
Obrigado Adilson !!!
Gostei + 0
16/02/2004
Gustavolange
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)