LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

MySQL query

Hi!

 

I'm trying to send a MySQL query to a table in a database, I have looked around at the forum but though I have found similar examples I can not make it work.

I think that the Query is right, bacause it works if i write it directly in the DB. But some how I cant make it work when using the LabVIEW DB conectivity tool...

 Do anybody have a ide of where I'm doing wrong? I get a error message in the writeQuery.vi..

0 Kudos
Message 1 of 4
(3,203 Views)

What's the error? That kind of information is important in trying to help.

 

The only think I would question is the data type of the column. If it's a numeric, you don't use the ' around the mumbers.

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

Hi!

 

It is a VARCHAR(35) so i think thet the '' os right.

The error message is

 

"NI_Database_API.lvlib:Conn Execute.vi->FinalTestStart.vi<ERR>Exception occured in Microsoft OLE DB Provider for ODBC Drivers: [MySQL][ODBC 5.1 Driver][mysqld-5.1.36-community]Unknown column '’10’' in 'field list' in NI_Database_API.lvlib:Conn Execute.vi->FinalTestStart.vi"

 

ANd it occures when I try to write the Query whith the built in Vi.

0 Kudos
Message 3 of 4
(3,195 Views)

The only other thing I see is that there is no space before the WHERE clause.

 

I have not used MySQL much but with SQL Server, what I often find helpful in debugging a query is to copy a working query from the whatever built-in that the database and then paste it into a string constant in LabVIEW. So, instead of using the concantanate string, just use the constant. You could also right click on the Execute Query function and set SubVI setup to show front panel, close afterwards, and suspend when called. That way, the subVI will pause and you can look at/modify the query and run it over and over.

0 Kudos
Message 4 of 4
(3,182 Views)