LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Database Connectivity Toolset

I am using LabVIEW v 7.1.+ Database Connectivity Toolset v.1.0.1 + Microsoft Access 7 + XP Profesion
My table has 33 fields between I32, Strings and Doubles.
When desinged the ACCESS table, in the Double type fields I have choosen for all of them the fix format with 0 or 2 decimals depending of the field.
After writing to the table using the DB Tools Insert Data.vi, I have open it direclty with the ACCESS and checked that the number of decimals where according to the ones I set, so they are OK.

However,when I read the table using the DB Tools Open Connection.vi +DB Tools Execute Query.vi + DB Tools Fetch Recordset Data.vi + Databae Variant To Data.vi (I am attaching the example)and send the data to LabVIEW Table, the number of decimals of the doubles shown in the LabVIEW table does not correspond to those I have pressetted, 0 or 2.

Can anyone help me to overcome this problem?

Thanks a lot!
Simbani
0 Kudos
Message 1 of 2
(2,629 Views)
Simbani,

When you select 2 decimals in Access what is actually doing is, its just displaying you the decimal places that you selected. But when you retrive data from the table it send you all the decimal places. To over come this problem you need to modify your SQL SELECT statment like below...

SELECT ROUND(column1, 2), ROUND(column2, 2), column3 FROM tablename WHERE condition

ROUND function will Round off to the nearest decimal that you specify.


Hope its helps you


Regards,
Suresh
0 Kudos
Message 2 of 2
(2,569 Views)