10-08-2020 02:59 PM
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.
Solved! Go to Solution.
10-09-2020 02:04 AM
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.
10-09-2020 06:20 AM
@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. 🙂
10-09-2020 07:37 AM
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.
10-09-2020 07:42 AM
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.
10-09-2020 08:26 AM
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.
If you right click on that control and set “Show type” you get this:
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!
10-09-2020 08:40 AM - edited 10-09-2020 08:42 AM
@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. 🙂