![]() |
ZeosDBO -> Kommazahlen an MySQL übermitteln?!
Hallo!
Warum schreibt Delphi mir nur gerundete Zahlen in das Field (Float)?
Delphi-Quellcode:
Vielen Dank für die Hilfe!
frmmain.qu.SQL.Text:='UPDATE prize Set '+
'prize1 ='+formatfloat('0,00', p_prize1)+ ', prize2 ='+FormatFloat('0,00', p_prize2)+ ', prize3 ='+FormatFloat('0,00', p_prize3)+ ' WHERE day='+IntToStr(p_day); Gruß 1PM |
Hi,
weil die Funktion FormatFloat, auf die Anzahl der Stellen hinterm Komma rundet ! Data |
Hallo!
Hat jemand einen Lösungsvorschlag? Danke im voraus! Gruß 1PM |
Delphi / ObjectPascal ist und bleibt eine englischsprachige Programmiersprache, und bei den Engländern / Amis ist das Dezimaltrennzeichen nunmal ein Punkt (.) und kein Komma (,).
Richtig wäre:
Code:
Viel Spass
String := formatfloat('0.00', value);
|
Hallo Phoenix!
Wenn ich einen Punkt angebe bekomme ich beim Speichern einen Fehler! Anscheinend nimmt er nur Komma?! :cry: Gruß 1PM |
Punkt oder Komma?, das hängt (standardmäßig) von den lokalen Sprach- und Landeseinstellungen ab.
...:cat:... |
Hallo Sakura!
Das stimmt schon, aber es wird nur ein Komma zum speichern akzeptiert! Sonst bekomme ich Fehlermeldung! Mit Formatfloat geht es, doch allerdings rundet er ja! :/ Mit FloatToStr() habe ich es bereits auch schon probiert, da rundet er mir auch! Und nun! Danke für eure Hilfe! Gruß 1PM |
Niemand anders eine Idee? :?
|
IDEE
Moin moin IPM
Also ohne viel Worte: showmessage( FormatFloat( '#,##0.00',3.1495677) ); showmessage( FormatFloat( '#,##0.00',Int(3.1435677*100)/100) ); Hilft das ?? |
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:52 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz