ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem adding data from LabView to mySQL through ADO

Hi. I want to use mySQL from LabView and I don't (and won't) have the Database Connectivity Toolset, so I decided to communicate with it through ADO, using the respective myOLEDB driver. I have succeded in executing simple SQL text queries and even reading data from tables, but I'm still not able to insert data them. I know about two ways:

1. Create command to retrieve an empty (or not) recordset, use the "addnew" method and update. This gives me an error. I have read about an addnew method error (or bug) on LV 6 and a supposed workaround, it is supposedly also solved on LV7.1, but the bug (or error) is not solved and the workaround doesn't work. I think the problem is that the "values" parameter of the addnew method requires a SAFEARRAY input. I also have read about passing SAFEARRAYs to activex components, but I have only found repetitive answers which are not enough clear for me. I'm not a C++ expert.

2. Create a parameterized query command, create and append parameters, assign parameter values and update. This doesn't work too. I followed a VB example and "translated" it into LabView, but no success. I attach some part of the code.

If anyone has worked with ADO and/or mySql and has a sample VI, or has a sample VI to build SAFEARRAYs or has some workaround or suggestion, your contribution will be greatly appreciated.

(Three days working on this)

Regards,

Daniel R.
UdeC - Chile

Daniel Ramírez
MSc - Mechanical Engineer
Universidad de Concepción
0 Kudos
Message 1 of 3
(3,279 Views)
If you don't want to buy the Database Connectivity Toolkit, give LabSQL a try at http://jeffreytravis.com/. It works great and comes with several examples including inserting data using the SQL command INSERT INTO.
Message 2 of 3
(3,276 Views)
Hi. Thanks for your suggestion, but I have already tried it and it inserts just simple data through sql queries without using parameters. It's a good tool, but I need to work with BLOBs and other kinds of complex data, so it's not enough for me.
0 Kudos
Message 3 of 3
(3,265 Views)