LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use parameterized statements with labSQL?

Hi everybody,

 

I have a big problem with labSQL. Every statement or query I have to use in my program works correctly, but I have a performance problem when writing my data to the database. The problem is the handling of the SQL statements by the DB. The solution will be the use of parameterized statements with labSQL.

The manual for NI Labview Database Connectivity Toolkit provides such information, but there are large differences to labSQL, and I don't get the clue. Is anybody able and would be so kind to help me? If someone has an example for using parameterized SQL statements with labSQL or the ADO methods for such stuff, please be so kind to share it with me.

 

Thank you for reading all of this 🙂

 

Best regards,

Matthias

0 Kudos
Message 1 of 3
(2,348 Views)
Searching the net will yield information on how to use ADO to create parameterized statements. Here's one. As far as LabSQL is concerned, it has a few VIs to deal with command parameters. The provided VIs will allow you to use method 2 shown in the MS article. If you want to use method 3 the parameters collection is readily available from those same VIs.
0 Kudos
Message 2 of 3
(2,336 Views)

Thank you very much for your help. I already had set up the correct SQL statement and created the parameters but got errors when executing the command object. After some tries I found that neither the SQL statement nor the parameters were the source of the error, as I had expected first.

 

The problem was that I was sending the wrong data type to the execute method of the command object. It expected some variant input for the parameters. I send an array of strings, which caused an error. I casted that array to variant with the same result. But a single string to variant worked well (with only one parameter in the SQL statement). The easy solution was to cast all strings to variants, and then build an array out of them. The execute method worked with that. Now the transaction is 4 times faster than before Smiley Very Happy

 

Thanks again!

 

Edit:

If someone is interested in some example VI, please let me know. I should have some time next week to build one.

Message Edited by manicnobody on 02-26-2009 10:19 AM
0 Kudos
Message 3 of 3
(2,329 Views)