02-07-2011 06:00 AM
Hi,
I think this question would be simple.
I'm working with a mySQL Database. I proceed as follow:
1) I open the connexion (OK),
2) Insert data on table -table1- (OK),
3) Execute a query (OK?)
4) Create a new table (table2) and Insert data from query.
In step 3, when I visualize all data (fetch all) in table, the headers belong to table1, but data are correct.
Also, in step 4, no data has been inserted in new table (in fact, the new table has not been created). This is the error:
"Error 1 occurred at DB Tools Create Table If Not Exist.vi->DB Tools Insert Data.vi->00_Volcado a la BD.vi
Possible reason(s):
Argument error; the number of columns does not equal the number of parameters."
Any idea?
Thank you
02-07-2011 11:47 AM
vicens,
I think I know the cause of the error message. Whenever you use "as A1, as A2" ..." in your statement,
it actually creates extra columns in your returned data. I'm sure you should see this in your converted
data array.So this might explain the number of columns mismatch.(I think)
Anyway, in my project I've only used cluster data type to insert data and it works fine. You can consider implementing
it this way. I haven't been able to successfully insert database variant directly, either. Got the same
error as you did. I'm almost certain it's related to the data structure but I haven't figure out how to solve it.
I only recently started using theDB ToolKit as well.
Perhaps, someone else can chime in ..!?
02-10-2011 01:01 AM
Thanks for answering chad_vi,
Finally I decided to create the table from mysql. The next step was to select the data to insert (via query).
I ask myself the following:
The recordeset reference of subvi 'DB tool execute query ' maintains the structure of the table read (in this case table 1) but only shows me the desired values in the query? If so would mean that do not match the number of columns.
02-10-2011 08:30 AM
Hmm..interesting ! Insert data via query",
I'm not aware of using query this way. Again, I'm by no means
a SQL guy, but it's always cool to learn new tricks.
Thanks for sharing ~