04-14-2006 02:08 PM
04-14-2006 03:13 PM
| Robst - CLD |
| Using LabVIEW since version 7.0 |
04-15-2006 05:01 AM - edited 04-15-2006 05:01 AM
In the case that I am using MS ACCESS table, if the last (fifth) colon is declared as a type OLE OBJECT in the table message "Long binary data" appears. But I need the number coresponding to the measured voltage in the fields of the table. How can I read this "Long binary data" or convert this into data representing the voltage value.
Another question. If I am using MySQL table, OLE OBJECT type does not exist. Which field type do I use in this case, if I want to insert a MySQL table number corresponding to the measured voltage.
Many thanks.
Message Edited by Jaka on 04-15-2006 05:04 AM
04-17-2006 07:55 AM
You cannot insert an array into a table whose other fields are simple strings, etc. You can do two things. Create a new table with a join to the original table where the voltage will be inserted, or insert each element in the array one by one by using a for loop with auto indexing.
Hope this helps
04-17-2006 08:38 AM
04-18-2006 10:09 AM
Most database management systems don't recognize the data type of an "array". So what you have to do is either use a binary field (called OLE Object in Access, BLOB in Oracle, etc) or you have to write one element of the array at a time to a field of that data type (numeric in this case). The second method is very slow, but since it uses the simple data type of the database, you can then often do operations on it. If it's a binary field (not unlike saving data to a binary file), it's a lot faster, but you need to know exactly what the format of the data is in order to read it out and operate on it later.
If you use the Database Connectivity Toolkit with LabVIEW, it will automatically flatten arrays to string, create a binary field, and write the binary data to it. To read that data back into LabVIEW, you use the Database Variant To Data function and describe the type as what it was originally - probably a 1D array of DBL. If you are using other software to write and read the data to the table, you need to pay close attention to how that data is converted to and from the array in order to get it back.
Data type conversions can be very tricky between any app and a database. I know I didn't specifically address your questions, but I hope you better understand the situation now.