LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

access database error (1)

Solved!
Go to solution

I'm using MSOffice 2010, Labview 2015.

 

I have a loop that collects three data points to be inserted into an Access DB using the OLEDB driver.  As a debug tool I insert the data one column at at time when the data point is created and then again outside the loop as a cluster calling out each of the three columns to insert into.  The insert inside the loops works well.  The same code with the added columns gives an err (1) outside the loop when I try to write all thee values in one record (three  columns).  The issue appears to be with the cluster as if I change the code outside the loop to write only one column all works fine again.

 

My goal is to be able to write all three columns in one record.  

 

I am attaching a commented image of my code and the VI.

Download All
0 Kudos
Message 1 of 8
(4,653 Views)

If you open the "DB Tools Insert Data" VI it should have about 8 SubVIs in it.  Can you run your VI with "highlight exectuion" on and see which SubVI the error comes from?

0 Kudos
Message 2 of 8
(4,614 Views)
It might be helpful also if you divulge what the error is... Or are we supposed to guess?

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 3 of 8
(4,592 Views)

I believe that you can only use the insert data VI only once per open database connection. In your screenshot, you tried to use it twice. That's why youre getting an error.

I made some adjustments to the attachement. See if that works for you.

Make sure that you name your columns in your access database in the same order they are in your VI.

 

 

0 Kudos
Message 4 of 8
(4,555 Views)

Sorry Mike I was unable to make the error code (1) obvious.  I placed an annotated picture of where the error code is generated in hopes of being very detailed.  I will try to make it more clear next time.

 

The error code (1) is "An input parameter is invalid" .  Digging into the inner VIs the API.lvib:DB Tools Parser.vi appears to be changing my three data points into nine.  With nine data points and only three columns defined an error (1) is generated.

 

I will keep digging into this.

 

Raymond

0 Kudos
Message 5 of 8
(4,526 Views)
Solution
Accepted by Raymond123

Your problem is with the Array to cluster that you use in your own vi. 

By default it will make a cluster with 9 elements, no matter how large your array is. And the size of the cluster is fixed at development time. I would steer away from that, use your array direct in the insert vi. 

 

0 Kudos
Message 6 of 8
(4,518 Views)

CAEHP: Where did you get the idea about that you can only insert to a database one time pr. connection? That is just plain wrong

As long as the connection is valid you can insert as many times as you like, and to as many tables as you like. 

0 Kudos
Message 7 of 8
(4,514 Views)

Thanks everyone.  CAEHP's example did work other than it was inside the loop and caused too many entries.  I did not know about the  Array to cluster defaulted to 9 elements.  I changed my original code to stuff the 3 elements into a bundle and passed that along to the database tool kit.

 

Case closed.

 

 

Thanks,

Raymond

0 Kudos
Message 8 of 8
(4,493 Views)