When using the following on SQLite I get the errormessage '' is not a valid floating point value
When running MS Access, MySQL or MS SQL the error isn't there.
What can I do to have this go away?
fldSum is defined as a Float in the SQLite db
curBought := QueryMain.FieldByName('fldbuyer_sum').AsCurrency;
intBuyer := QueryMain.FieldByName('fldbuyer_id').AsInteger;
QueryInput.SQL.Clear;
QueryInput.SQL.Add('SELECT Sum(fldamount) AS fldsum FROM ' + conTable_Payments_Buyer);
QueryInput.SQL.Add(' WHERE fldbuyer_id = :fldbuyer_id');
QueryInput.SQL.Add(' AND fldauction_guid = :fldauction_guid');
QueryInput.ParamByName('fldauction_guid').Value := Settings.Auction_GUID;
QueryInput.ParamByName('fldbuyer_id').Value := intBuyer;
17-03-2010 11:35:36 # '' is not a valid floating point value
SQLite - '' is not a valid floating point value
Your query returns NULL value:
QueryInput.SQL.Add('SELECT Sum(fldamount) AS fldsum FROM ' + conTable_Payments_Buyer);
QueryInput.SQL.Add(' WHERE fldbuyer_id = :fldbuyer_id');
QueryInput.SQL.Add(' AND fldauction_guid = :fldauction_guid');
NULL cannot be converted to number and you get error "'' is not a valid floating point" value in the line:
curPaid := QueryInput.FieldByName('fldSum').AsCurrency;
You have two way to fix this issue:
1. Fix programm:
if QueryInput.FieldByName('fldSum').IsNull then
curPaid := 0
else
curPaid := QueryInput.FieldByName('fldSum').AsCurrency;
2. Fix your query to return zero instead of NULL value.
QueryInput.SQL.Add('SELECT Sum(fldamount) AS fldsum FROM ' + conTable_Payments_Buyer);
QueryInput.SQL.Add(' WHERE fldbuyer_id = :fldbuyer_id');
QueryInput.SQL.Add(' AND fldauction_guid = :fldauction_guid');
NULL cannot be converted to number and you get error "'' is not a valid floating point" value in the line:
curPaid := QueryInput.FieldByName('fldSum').AsCurrency;
You have two way to fix this issue:
1. Fix programm:
if QueryInput.FieldByName('fldSum').IsNull then
curPaid := 0
else
curPaid := QueryInput.FieldByName('fldSum').AsCurrency;
2. Fix your query to return zero instead of NULL value.