when i convert a string value into float it takes o.oooo. here is the code.
NSString *amt=txtTotalBill.text;
NSLog(@"%@",amt);
float amount = [amt floatValue]
NSLog(@"%f",amount);
NSString *insertData=[NSString stringWithFormat:@"insert into tbl_Bills(Amount,Note,Due_On) values ('%f')",amount];
[database executeQuery:insertData];
NSLog(@"inert query: %@",insertData);
NSLog(@"value inserted");
[table reloadData];
[database close];
everytime it takes amount as 0.0000.In this code amt value is correct but that string value doesnt convert into float.
just tried some of your codeblock and it works out fine for me. The error could be in the NSString itself. Perhaps its not passing in a totally numerical number. Try using a CGFloat as well, although this shouldn’t change anything.