开发者

read float from SQLite

开发者 https://www.devze.com 2023-01-23 14:56 出处:网络
I used the codes below to load data(float) and store in an array. 开发者_开发问答My oject has one float field \'value\' (setValue,getValue to read or write value)

I used the codes below to load data(float) and store in an array. 开发者_开发问答My oject has one float field 'value' (setValue,getValue to read or write value)

rowData=(char*)sqlite3_colum_text(statement,0);
float v=[[NSString  initWithUTF8String:rowData] floatValue];
[myObject setValue:v];
[myArray addObject:myObject]; 

If I read the value from the array using float tem=[[myArray objectAtIndex:i] getValue];

I found all values are not correct, everyone is 0.00000000000000

Welcome any comment

Thanks

interdev


If your values are stored as float numbers in database you should get them using sqlite3_column_double function, not sqlite3_column_text

0

精彩评论

暂无评论...
验证码 换一张
取 消