LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trouble writing to a database

Seems to me like this problem's pretty trivial, but for the life of me, I can't figure it out. I have a little subVI that just opens a database, and uses the Insert Data VI to write a single row to a pre-existing database. Basically, I can write single columns, or if I specify multiple columns, no problem. But if I don't specify columns, and try to write a 44-column entry to the database that was just opened, I get an error (-2147467259) that sais the number of query values and destination fields are not the same. But if I check, the number of fields in the request is 44, and the number written is also 44.

Any ideas what I could do to see where the problem is? Thank you!

seppo
0 Kudos
Message 1 of 5
(3,132 Views)
It sounds like the problem is that the table you're inserting into has something other than 44 columns. The way SQL works is that if you don't specify column names in the insert statement, the DBMS assumes that you are inserting data into all the columns--in the order they appear in the database structure.

If the solution is to include the column names, include them--it's not a bad idea anyway.

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 5
(3,132 Views)
hi

I get the same error " Number of query values and destination fields are not the same." altohugh with another number -2147217900. I just want to copy entries (rows) from a table "temp" of DB_1 to the table "temp" (same fields) of DB_2. and IS IMPOSSIBLE to perform this task in a simple way. i get this error, altough the table-fields are the same, and even using "column names" (as proposed form mike), or using the VI "get column names" to be sure that the correct names are parsed.

any1 kwows whats going on ?
0 Kudos
Message 3 of 5
(3,132 Views)
SQL is picky about the column names, and that may be the problem. No spaces or certain characters. It is best to just use alphanumeric characters and use an underscore if you want to separate words. Also, the data must be of the same type.
0 Kudos
Message 4 of 5
(3,132 Views)
I already tried using the sub VI "get column names" so trhere cant be a type error, and aint working.

theres an easy way of "copy/paste" rows from a table to another?
0 Kudos
Message 5 of 5
(3,132 Views)