Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
My table has a numeric type column 'TX_AMOUNT'. I want to get the value from it to a String variable. In the following code I get correct result for small numbers with
decimals. When the numbers are in large size say 6,2 (and above) in the column, the
string shows some wrong value. At the same time if the column has numbers of any size
without a decimal, it shows correct result. AT the time of insertion , I verified with a breakpoint everything is correct.

C#
String[] columns = { helper.TX_UID, helper.TX_NAME, 
helper.TX_PARTICULARS, helper.TX_AMOUNT, helper.TX_DATE,helper.TX_CONTRA}; 

Cursor c = db.query(VivzHelper.TX_TABLE, columns, (helper.TX_ID + "='" + 
name + "' AND " + helper.TX_DATE + "= '" + td + 
"'"), null, null, null,null);

gt = 0;
gt_selectedItem_number = 0;
if (c != null) {
c.moveToFirst();
while (c.isAfterLast() == false) {
String v_uid=(c.getString(0));
String txTotal = (c.getString(3)); //not ok
Float fl=(c.getFloat(3)); //not ok
Posted
Comments
Dadecki 21-May-15 3:44am    
Hello,

Please show your DB table structure.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900