07-24-2009 02:24 PM
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..
07-24-2009 02:31 PM
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.
07-24-2009 02:43 PM
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.
07-24-2009 03:58 PM
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.