LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I insert a 2D array of data into a database?

I have a 2D array of data coming from a data acquisition device. The data basically contains 8 channels of voltage readings. Using the database connectivity toolkit (LabVIEW 7.1), can I do an insert with this 2D array of data directly? I have a test Access table set up with field names of "data1, data2,...data8", but when I run this vi to test an insert, I get the following error:

DB Tools Build Insert Query.vi->DB Tools Insert Data.vi->DBTestArgument error; the number of columns does not equal the number of parameters.

I've set the "columns" connector of the DB Tools Insert Data.vi to match my table in Access, and this is a 1D string array, which I think would be correct.

Any ideas? Thanks in advance...
0 Kudos
Message 1 of 3
(3,556 Views)
If you write a 2D array of data (or any type of data that doesn't have a direct equivalent in the database) to a table, LabVIEW flattens that data to a binary string and writes that string into a single cell. That's why you get that error. If you want each item in the 2D array to go into a separate cell, you'll need to format the data appropriately; in this case, one value at a time probably using a double loop structure. This can often be a very slow process and is why the default behavior is to store the entire dataset in a binary string.

I hope this helps,
Crystal
Message 2 of 3
(3,556 Views)
yes, that does help. the application returns all sampled data read in a 2D array. at a point within the program, I seperate the "channels" out in order to display their individual values to the user front panel. so, what I ended up doing was to cluster all of those 8 values, then pass the cluster into "DB Tools Insert Data.vi". This gave me a table with 8 columns, which represent the 8 channels. thanks for your input.
0 Kudos
Message 3 of 3
(3,556 Views)