LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Headers when create a Database table

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

0 Kudos
Message 1 of 4
(2,381 Views)

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 ..!?

0 Kudos
Message 2 of 4
(2,344 Views)

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.

0 Kudos
Message 3 of 4
(2,308 Views)

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 ~

0 Kudos
Message 4 of 4
(2,285 Views)