LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Argument error; the number of columns does not equal the number of parameters.

I am using the Database Toolkit (Enterprise Connectivity) to check for a network connection and then send information from a local database to a SQL database on the network if needed.  In development of the code I continue to receive Error 1 and the Possible Reason(s) is "Argument error; the number of columns does not equal the number of parameters."  I am using the DBToolsSelectData.VI to retrieve data from the local MDB file and the DBToolsInsertData.VI to write it to the SQL file.  The collection of the data from the MDB file is successful and the connection and validation of the table and columns in the SQL file is also successful.  The error occurs when the Insert VI tries to build the query.  The number of columns being written (attempted) does match the number of columns in the data, they are both 16 string arrays.
0 Kudos
Message 1 of 11
(8,547 Views)
Actually, this sounds like an SQL error coming from the database. Can you post an example of the insert script that is being executed, and the structure of the table that data is being inserted into? This should be an easy matter to sort out.

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 2 of 11
(8,534 Views)
Mike,
 
I have attached the UDL file used for the MDB connection, the MDB (using the Results table) and the VI that I created to test operation.  The structures of the tables in the MDB file were copied from the SQL DB so they are the same.
 
Thanks for your help.
 
Jason
0 Kudos
Message 3 of 11
(8,521 Views)
I'll get back with you this evening...

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 4 of 11
(8,515 Views)
I got your code to run, but I get a syntax error at the insert VI.  I'm not an SQL expert.  Could you tell me what "[Reliability].[dbo].[Results]" means?  Which table are you trying to insert this into?
0 Kudos
Message 5 of 11
(8,456 Views)
[Reliability] is the SQL database, [dbo] is the creator and [Results] is the SQL table that we are trying to insert data into.  This information is required when creating an SQL execution string.  It directs the information to the appropriate database located on a server.
0 Kudos
Message 6 of 11
(8,437 Views)
Ok, it's taken a bit, and I have a solution! It took a while to figure out what the DCT is doing, but it seems to be working now.

The reason for the original error is that you were passing into the insert subVI an array of variants - which the input to the VI coerced into a single variant. You were getting the error because as far as the insert VI was concerned you were only passing it a single data value. The way to get around that was to create a cluster with one element for each column value, convert the cluster to a variant and pass the result to the insert VI - see attachment.

In terms of the other modifications, I made a copy of the endurance.mdb file, emptied it and used it as the destination for the copy.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

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

For help with grief and grieving.
Message 7 of 11
(8,421 Views)

Mike,

Thank you for your help with this.  I am away from the office for the remainder of the week this so I won't be able to use this until Monday.  I will repost to confirm operation but I am confident it will be OK.

 

Jason

0 Kudos
Message 8 of 11
(8,407 Views)

Dear mike, 

         I facing a same issue in my program, but i did as per your previous guidance of him, but my issue is not solved, i don't know where i'm making mistake, Can you please find out my mistake and suggest me how to do it in best way, because i have to transfer bulk of array values into my sql db.

Thanks in advance

0 Kudos
Message 9 of 11
(5,295 Views)

You're doing an Array to Cluster which by default puts 9 elements in the cluster.

 

Does your data have 9 columns?

 

If you want to change the size of the cluster, right click on the Array to Cluster and change the number.

Message 10 of 11
(5,288 Views)