LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Database column vs data count mismatch. ADO Error: 0x00000001

Solved!
Go to solution

I am trying to write to a database. I can read from the database, and create new tables, so I have read/write access. However, when I try to write I get "Possible reason(s):
ADO Error: 0x00000001
Argument error; the number of columns does not equal the number of parameters."


To try and trouble shoot this I simplified things to a table with 2 columns with a datatype of string. I created an array of two strings to write and idiot proofed the column name selection to prevent typing errors. I am getting long in the tooth, but I am pretty sure I can still count to two. I tried this with just an array going to the insert vi and as a cluster, as that came up once in the forums. No dice. Code is attached.

0 Kudos
Message 1 of 7
(1,662 Views)
Solution
Accepted by topic author rimfire44

Each member in the input cluster counts for one column.

You should cluster-ize two separate strings instead of a single array with two elements.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 2 of 7
(1,610 Views)
Solution
Accepted by topic author rimfire44

@rimfire44 wrote:

I am trying to write to a database. I can read from the database, and create new tables, so I have read/write access. However, when I try to write I get "Possible reason(s):
ADO Error: 0x00000001
Argument error; the number of columns does not equal the number of parameters."


To try and trouble shoot this I simplified things to a table with 2 columns with a datatype of string. I created an array of two strings to write and idiot proofed the column name selection to prevent typing errors. I am getting long in the tooth, but I am pretty sure I can still count to two. I tried this with just an array going to the insert vi and as a cluster, as that came up once in the forums. No dice. Code is attached.


I'm not so sure, your Array to cluster is set to 9. 🙂

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 3 of 7
(1,602 Views)

Thank you for the help! I sure missed that one from the examples and the help states "If data is not a cluster, this VI inserts the data to the column specified by the columns input." An array of two data items along with an array of two column names sure seems to fit that.  

 
   
0 Kudos
Message 4 of 7
(1,595 Views)

Duh! I have been doing this for fourteen years and have never used that array to cluster block.  I always just define the cluster and generally typedef it. And I sure wouldn't have thought to right click on it anyway. I just assumed it would autosize the output to match the input.  

 

Whoever said that "Ignorance is bliss" was not an engineer.  

 

Thank you very much!  I should have written three days ago instead of burning neurons.  At my age, I can't afford to lose any of them unnecessarily. 

Message 5 of 7
(1,592 Views)

For those of you that might need more detail here is what I dug up after the two gentlemen above set me on the golden path.  

 

If you create a control from the data input connection on that databas update block you get this a control that mystified me. 

rimfire44_0-1602248791998.png

 

If you right click on that control and set “Show type” you get this: 

rimfire44_1-1602249061155.png

 

it is not clear that this is a cluster as represented in the variant world until you set Show Type.  At least not to me. 

 

It turns out that the bomb-proof way of doing this is to define a cluster and load it with the X elements to match your column count. That makes things truly explicit. Better yet, type-def it and use it wherever you like.   While you apparently don’t need to specify the column names if you use a cluster, it sure clarifies things and makes debugging easier if you make a mistake. Not that I ever make a mistake of course....... 

 

Thanks again to everyone! 

Message 6 of 7
(1,581 Views)

@rimfire44 wrote:

Duh! I have been doing this for fourteen years and have never used that array to cluster block.  I always just define the cluster and generally typedef it. And I sure wouldn't have thought to right click on it anyway. I just assumed it would autosize the output to match the input.  

 

Whoever said that "Ignorance is bliss" was not an engineer.  

 

Thank you very much!  I should have written three days ago instead of burning neurons.  At my age, I can't afford to lose any of them unnecessarily. 


Had you done an Index Array -> Bundle it'd have worked directly. That block is a Little tricky in that it doesn't give any information about size without r-clicking on it. It should have a number overlayed or some sort of indicator to show the size (with the possibility to hide). I've done that a few times so i had a suspicion. 🙂

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 7 of 7
(1,577 Views)