LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error trying to insert 240 columns into a database

My VI reads a spreadsheet text file and attempts to write the data to a database. The database has 240 fields and the text file has 240 entries. When I run the app I get an error "Argument error; the number of columns does not equal the number of parameters." in DB Tools Insert Data.vi - seems to come from another vi called Parser.

Looking thru the code it indicates I need to use a cluster so all of the data will go to one record. Also I have tried variant data.
0 Kudos
Message 1 of 3
(2,865 Views)
The problem is in the Array to Cluster conversion -- the default size is 9 so it was only taking the first 9 elements of the array. Pop up on the Array to Cluster and select Cluster Size and change it to 241. That should work.

Also, I modified your VI a little for this. I also changed the array manipulation to use the least amount of memory and got rid of the extraneous sequence structure.
0 Kudos
Message 2 of 3
(2,865 Views)
Thanks Crystal,

That did indeed fix the error. Once I made that change I got an SQL error

Possible reason(s):
Exception occured in Microsoft OLE DB Provider for ODBC Drivers, [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.. in Rec Create - Command.vi->Cmd Execute.vi->DB Tools Insert Data.vi->writeKPIV_(modified).vi

This was caused by spaces and equals signs in the field names.

Everything works great now. Thanks
0 Kudos
Message 3 of 3
(2,865 Views)