LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ITS JUST NOT ME...

Hello,
 
Some of you may be familiar with my posts concerning MS Access & LabVIEW.
If not, I have been having problems inserting data by way of DBCT into MS Access.
 
My data would insert into the database but would come out as "long binary data."
 
But now, I know it is not just something I am doing wrong because when I looked at the examples by LabVIEW, I found that the logging example.vi also had "long binary data" for "Core Temp and Core Pressure."
 
So my question to LabVIEW professionals (when I looked for a way to contact you, it says to put my question in this forum)is how can this problem be fixed.  Is this some type of bug?  What is the issue?
 
I tried to change the data type to Numbers from OLE object in the db but it does nothing but bring me back to square one.
 
Thanks for any help and sorry if I sound a little angry.
0 Kudos
Message 1 of 6
(3,141 Views)
R
 
There is nothing wrong with the example. Core Pressure and Core Measurements are 1D array of DBL and 2D array of DBL repectively. The example is demonstrating that arrays are treated as OLE Objects when you insert that type of data into a table using the DBCT. Look at the connections for the DB Tools Insert Data VI in the while-loop. It has the flag (boolean) Create Table = True. So that means that every time you run the VI the old table will be deleted and replaced with a new empty table to accept the new data. So thats why you change to the datatype in the Access table for Core Pressure and Core Measurements didn't take.
 
Every interation in the while loop creates one record in "logging" table.
 
David
Message 2 of 6
(3,090 Views)

To add to what David said... the Database Connectivity Toolkit converts any datatype that doesn't have a direct equivalent in the database management system to a binary format.  Each database management system does have a binary datatype -- Access has an OLEObject, Oracle has BLOBs, etc.  Arrays, clusters, complex numerics, pictures, waveforms and others don't have a direct equivalent in the database apps, so they are all flattened to binary strings and saved into binary fields.  The reason the variant displays "non-displayable" is that it doesn't know how to interpret a raw binary string.  You need to use the Database Variant To Data function to convert that variant to whatever it was originally.  The data is still there, you just need to know how to convert it back.

Message 3 of 6
(3,056 Views)

To add to what David said... the Database Connectivity Toolkit converts any datatype that doesn't have a direct equivalent in the database management system to a binary format.  Each database management system does have a binary datatype -- Access has an OLEObject, Oracle has BLOBs, etc.  Arrays, clusters, complex numerics, pictures, waveforms and others don't have a direct equivalent in the database apps, so they are all flattened to binary strings and saved into binary fields.  The reason the variant displays "non-displayable" is that it doesn't know how to interpret a raw binary string.  You need to use the Database Variant To Data function to convert that variant to whatever it was originally.  The data is still there, you just need to know how to convert it back.

 

Eureka may have been my answer if it worked for me as simple as you imply (I am not being sacrastic).  But the problem is it does not work for me. Can you please show an example with variant and without variant going to MS Access as the data that is "converted back" as the original number garned from LabVIEW subVI using the logging example by NI even. 

Thanks.

0 Kudos
Message 4 of 6
(3,005 Views)
Read the VI description for the logging example. It tells you that you can use either of the playback examples to read the data inserted by the logging example from the database.
 
This should tell you what you need.
 
David
Message 5 of 6
(2,991 Views)
In addition to looking at the Logging and Playback examples, look at the Sixtypes Insert and Sixtypes Select examples.  Lots of different types of data are written to the database and then converted back to original LV datatypes using the Database Variant To Data function. 
 
I also recommend reading the Database Toolkit User Manual - Chapter 3 for Writing Data to a Database and Reading Data from a Database sections. 
Message 6 of 6
(2,955 Views)